zombieyang / puerts_unity_webgl_demo

在Unity里用Typescript写小游戏/Web游戏
BSD 3-Clause "New" or "Revised" License
186 stars 66 forks source link

执行puerts-webgl/build puerts-js for browser时报错 #30

Closed Icekettle closed 1 year ago

Icekettle commented 1 year ago

error log | 日志或报错信息

System.Exception: node:internal/modules/cjs/loader:933: Error: Cannot find module '@puerts/build-util' Require stack:

Error: Cannot find module '@puerts/build-util' Require stack:

请问是什么原因啊?

zombieyang commented 1 year ago

没有在D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~执行npm install

Icekettle commented 1 year ago

没有在D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~执行npm install

大佬,执行完npm install后报这些错误了:

System.Exception: node:internal/modules/cjs/loader:933: Error: Cannot find module 'to-fast-properties' Require stack:

Error: Cannot find module 'to-fast-properties' Require stack:

Icekettle commented 1 year ago

单独npm install to-fast-properties后

没有在D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~执行npm install

大佬,执行完npm install后报这些错误了:

System.Exception: node:internal/modules/cjs/loader:933: Error: Cannot find module 'to-fast-properties' Require stack:

  • D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules@babel\types\lib\definitions\index.js
  • D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules@babel\types\lib\builders\builder.js
  • D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules@babel\types\lib\builders\generated\index.js
  • D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules@babel\types\lib\utils\react\cleanJSXElementLiteralChild.js
  • D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules@babel\types\lib\builders\react\buildChildren.js
  • D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules@babel\types\lib\index.js
  • D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules@babel\core\lib\transformation\file\file.js
  • D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules@babel\core\lib\index.js
  • D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\glob-js\index.js
  • D:\PuerTS\puerts_unity_webgl_demo\projects\2_Basketball\noop.js

Error: Cannot find module 'to-fast-properties' Require stack:

  • D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules@babel\types\lib\definitions\index.js
  • D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules@babel\types\lib\builders\builder.js
  • D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules@babel\types\lib\builders\generated\index.js
  • D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules@babel\types\lib\utils\react\cleanJSXElementLiteralChild.js
  • D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules@babel\types\lib\builders\react\buildChildren.js
  • D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules@babel\types\lib\index.js
  • D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules@babel\core\lib\transformation\file\file.js
  • D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules@babel\core\lib\index.js
  • D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\glob-js\index.js
  • D:\PuerTS\puerts_unity_webgl_demo\projects\2_Basketball\noop.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules@babel\types\lib\definitions\index.js:68:25) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at Puerts.GenericDelegate.Action[T1,T2,T3] (T1 p1, T2 p2, T3 p3) [0x000a9] in D:\PuerTS\puerts_unity_webgl_demo\projects\2_Basketball\Library\PackageCache\com.tencent.puerts.core@1.4.0\Runtime\Src\JSType\GenericDelegate.cs:465 at WebGLPuertsPostProcessor.run (System.String runEntry, System.String lastBuiltPath) [0x00065] in D:\PuerTS\puerts_unity_webgl_demo\package\Editor\WebGLPostProcessor.cs:63 UnityEngine.Debug:LogError(Object) WebGLPuertsPostProcessor:run(String, String) (at D:/PuerTS/puerts_unity_webgl_demo/package/Editor/WebGLPostProcessor.cs:67) WebGLPuertsPostProcessor:browser() (at D:/PuerTS/puerts_unity_webgl_demo/package/Editor/WebGLPostProcessor.cs:81)

单独npm install to-fast-properties后问题消失,但是产生新问题:

System.Exception: node:internal/errors:841: Error: Command failed: npx webpack -c webpack.config.js [webpack-cli] Error: Cannot find module 'D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules\has\src'. Please verify that the package.json has a valid "main" entry at tryPackage (node:internal/modules/cjs/loader:400:19) at Module._findPath (node:internal/modules/cjs/loader:613:18) at Module._resolveFilename (node:internal/modules/cjs/loader:981:27) at Module._load (node:internal/modules/cjs/loader:841:27) at Module.require (node:internal/modules/cjs/loader:1061:19) at require (node:internal/modules/cjs/helpers:103:18) at Object. (D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules\is-core-module\index.js:3:11) at Module._compile (node:internal/modules/cjs/loader:1159:14) at Module._extensions..js (node:internal/modules/cjs/loader:1213:10) at Module.load (node:internal/modules/cjs/loader:1037:32) { code: 'MODULE_NOT_FOUND', path: 'D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules\has\package.json', requestPath: 'has' }

Error: Command failed: npx webpack -c webpack.config.js [webpack-cli] Error: Cannot find module 'D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules\has\src'. Please verify that the package.json has a valid "main" entry at tryPackage (node:internal/modules/cjs/loader:400:19) at Module._findPath (node:internal/modules/cjs/loader:613:18) at Module._resolveFilename (node:internal/modules/cjs/loader:981:27) at Module._load (node:internal/modules/cjs/loader:841:27) at Module.require (node:internal/modules/cjs/loader:1061:19) at require (node:internal/modules/cjs/helpers:103:18) at Object. (D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules\is-core-module\index.js:3:11) at Module._compile (node:internal/modules/cjs/loader:1159:14) at Module._extensions..js (node:internal/modules/cjs/loader:1213:10) at Module.load (node:internal/modules/cjs/loader:1037:32) { code: 'MODULE_NOT_FOUND', path: 'D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\node_modules\has\package.json', requestPath: 'has' }

at checkExecSyncError (node:child_process:828:11)
at execSync (node:child_process:899:15)
at module.exports (D:\PuerTS\puerts_unity_webgl_demo\package\Javascripts~\build.js:14:5)
at chunk:10:17

at Puerts.GenericDelegate.Action[T1,T2,T3] (T1 p1, T2 p2, T3 p3) [0x000a9] in D:\PuerTS\puerts_unity_webgl_demo\projects\2_Basketball\Library\PackageCache\com.tencent.puerts.core@1.4.0\Runtime\Src\JSType\GenericDelegate.cs:465 at WebGLPuertsPostProcessor.run (System.String runEntry, System.String lastBuiltPath) [0x00065] in D:\PuerTS\puerts_unity_webgl_demo\package\Editor\WebGLPostProcessor.cs:63 UnityEngine.Debug:LogError(Object) WebGLPuertsPostProcessor:run(String, String) (at D:/PuerTS/puerts_unity_webgl_demo/package/Editor/WebGLPostProcessor.cs:67) WebGLPuertsPostProcessor:browser() (at D:/PuerTS/puerts_unity_webgl_demo/package/Editor/WebGLPostProcessor.cs:81)

zombieyang commented 1 year ago

总觉得你是网络不太通所以某些包丢了。。删掉node_modules再重装呢

Icekettle commented 1 year ago

总觉得你是网络不太通所以某些包丢了。。删掉node_modules再重装呢

感谢回复!我后来把所有那些找不到的Module统统单独npm install了一遍,问题解决了,我滴个神啊