Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some building errors but more like a naming oversight #14

Open
Yunxi-awa opened this issue Jun 25, 2024 · 2 comments
Open

Some building errors but more like a naming oversight #14

Yunxi-awa opened this issue Jun 25, 2024 · 2 comments

Comments

@Yunxi-awa
Copy link

Yunxi-awa commented Jun 25, 2024

Here is the error output.

H:\CocosProject\PlantsVsZombies\extensions\live2d_cubismsdk_cocoscreator>npm install

added 3 packages, and audited 4 packages in 4s
found 0 vulnerabilities

H:\CocosProject\PlantsVsZombies\extensions\live2d_cubismsdk_cocoscreator>npm run build
> [email protected] build
> tsc -b

static/assets/Framework/ComponentExtensionMethods.ts:13:33 - error TS2724: '"cc".__private' has no exported member named '_types_globals__Constructor'. Did you mean '__types_globals__Constructor'?

13     classConstructor: __private._types_globals__Constructor<T>
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
static/assets/Framework/ComponentExtensionMethods.ts:25:38 - error TS2769: No overload matches this call.
  Overload 1 of 2, '(...items: ConcatArray<T>[]): T[]', gave the following error.
    Argument of type 'Component[]' is not assignable to parameter of type 'ConcatArray<T>'.
      The types returned by 'slice(...)' are incompatible between these types.
        Type 'Component[]' is not assignable to type 'T[]'.
          Type 'Component' is not assignable to type 'T'.
            'Component' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Component'.
  Overload 2 of 2, '(...items: (T | ConcatArray<T>)[]): T[]', gave the following error.
    Argument of type 'Component[]' is not assignable to parameter of type 'T | ConcatArray<T>'.
      Type 'Component[]' is not assignable to type 'ConcatArray<T>'.

25       components = components.concat(range);
                                        ~~~~~
static/assets/Framework/ComponentExtensionMethods.ts:39:33 - error TS2724: '"cc".__private' has no exported member named '_types_globals__Constructor'. Did you mean '__types_globals__Constructor'?
39     classConstructor: __private._types_globals__Constructor<T>
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
static/assets/Framework/Pose/CubismPoseController.ts:78:34 - error TS2339: Property 'groupIndex' does not exist on type 'Component'.
78       const groupIndex = tags[i].groupIndex;
                                    ~~~~~~~~~~
static/assets/Framework/Pose/CubismPoseController.ts:79:33 - error TS2339: Property 'partIndex' does not exist on type 'Component'.
79       const partIndex = tags[i].partIndex;
                                   ~~~~~~~~~
static/assets/Framework/Pose/CubismPoseController.ts:97:30 - error TS2739: Type 'Component' is missing the following properties from type 'CubismPosePart': groupIndex, partIndex, link
97       data = data.copyWith({ posePart: tags[i], part: tags[i].getComponent(CubismPart) });
                                ~~~~~~~~
static/assets/Framework/Pose/CubismPoseController.ts:114:19 - error TS2339: Property 'link' does not exist on type 'Component'.
114       if (tags[i].link == null || tags[i].link.length == 0) {
                      ~~~~
static/assets/Framework/Pose/CubismPoseController.ts:114:43 - error TS2339: Property 'link' does not exist on type 'Component'.
114       if (tags[i].link == null || tags[i].link.length == 0) {
                                              ~~~~
static/assets/Framework/Pose/CubismPoseController.ts:118:62 - error TS2339: Property 'link' does not exist on type 'Component'.
118       const linkParts = new Array<CubismPart | null>(tags[i].link.length);
                                                                 ~~~~
static/assets/Framework/Pose/CubismPoseController.ts:119:35 - error TS2339: Property 'link' does not exist on type 'Component'.
119       for (let j = 0; j < tags[i].link.length; j++) {
                                      ~~~~
static/assets/Framework/Pose/CubismPoseController.ts:120:30 - error TS2339: Property 'link' does not exist on type 'Component'.
120         let linkId = tags[i].link[j];
                                 ~~~~
Found 11 errors.

H:\CocosProject\PlantsVsZombies\extensions\live2d_cubismsdk_cocoscreator>npm run build
> [email protected] build
> tsc -b
static/assets/Framework/ComponentExtensionMethods.ts:39:33 - error TS2724: '"cc".__private' has no exported member named '_types_globals__Constructor'. Did you mean '__types_globals__Constructor'?
39     classConstructor: __private._types_globals__Constructor<T>
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error.

H:\CocosProject\PlantsVsZombies\extensions\live2d_cubismsdk_cocoscreator>npm run build
> [email protected] build
> tsc -b

H:\CocosProject\PlantsVsZombies\extensions\live2d_cubismsdk_cocoscreator>

I completely followed the instructions in the README file to import the SDK, but the build did not go smoothly.

I found that it was because there were two missing underscores in the static/sets/Framework/ComponentExtensionMethods.ts file.

Line 13: classConstructor: __private._types_globals__Constructor<T>
                                     ^
Line 39: classConstructor: __private._types_globals__Constructor<T>
                                     ^

After adding the underline, the build no longer had any problems. I think there must have been an oversight in the naming, because "__private._types_globals_Constructor" should be the correct version🤔

@nanshaws
Copy link

me too

@nanshaws
Copy link

The following error occurs when you add an extension directly with cocos

The plug-in main process failed to load. Error: Cannot find module 'D:\cocosWorkspaces\HelloWorld\extensions\live2d_cubismsdk_cocoscreator\dist\main.js'
Require stack:

  • D:\cocosCreator\Creator\3.8.3\resources\app.asar\node_modules@editor\package\dist\browser\package.ccc
  • D:\cocosCreator\Creator\3.8.3\resources\app.asar\node_modules@editor\package\dist\browser\index.js
  • D:\cocosCreator\Creator\3.8.3\resources\app.asar\node_modules@editor\package\index.js
  • D:\cocosCreator\Creator\3.8.3\resources\app.asar\node_modules@editor\creator\dist\startup\protected\browser\index.ccc
  • D:\cocosCreator\Creator\3.8.3\resources\app.asar\node_modules@editor\creator\dist\startup\protected\index.ccc
  • D:\cocosCreator\Creator\3.8.3\resources\app.asar\node_modules@editor\creator\dist\startup\index.ccc
  • D:\cocosCreator\Creator\3.8.3\resources\app.asar\node_modules@editor\creator\dist\init.ccc
  • D:\cocosCreator\Creator\3.8.3\resources\app.asar\node_modules@editor\creator\index.js
  • D:\cocosCreator\Creator\3.8.3\resources\app.asar\index.js
  • at Module._resolveFilename (internal/modules/cjs/loader.js:887:15)
    at n._resolveFilename (electron/js2c/browser_init.js:257:921)
    at Function.Module._resolveFilename (D:\cocosCreator\Creator\3.8.3\resources\app.asar\node_modules@editor\creator\index.js:8:24)
    at Function._resolveFilename (D:\cocosCreator\Creator\3.8.3\resources\app.asar\node_modules\cc\preload.ts:109:46)
    at Module._load (internal/modules/cjs/loader.js:732:27)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
    at Function._load (D:\cocosCreator\Creator\3.8.3\resources\app.asar\node_modules\cc\preload.ts:127:35)
    at Module.require (internal/modules/cjs/loader.js:959:19)
    at o (D:\cocosCreator\Creator\3.8.3\resources\app.asar\node_modules@editor\creator\dist\require.js:1:2742)
    at Package._init (D:\cocosCreator\Creator\3.8.3\resources\app.asar\node_modules@editor\package\dist\browser\package.ccc:1:2523)
    截图_20240929162503

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants