eggjs / egg

🥚 Born to build better enterprise frameworks and apps with Node.js & Koa
https://eggjs.org
MIT License
18.9k stars 1.82k forks source link

egg 3.15.0 ts 版本,打包pkg时报错 Failed to make bytecode for ExpoRandom.js #5240

Open pxim opened 1 year ago

pxim commented 1 year ago

egg 3.15.0 ts 版本,打包pkg时报错 Warning Failed to make bytecode node16-x64 for file C:\snapshot\hackernews-async-ts\node_modules\expo-random\build\Random.js

image

我没有使用expo-random这个库,不知怎么屏蔽这个库

企业微信截图_16899026617542

企业微信截图_16899026762384 image

pxim commented 1 year ago

2023-07-21 09:57:05,727 INFO 27632 [master] =================== egg start ===================== 2023-07-21 09:57:05,728 INFO 27632 [master] node version v16.16.0 2023-07-21 09:57:05,728 INFO 27632 [master] egg version 3.17.3 2023-07-21 09:57:05,728 INFO 27632 [master] start with options: {"framework":"C:\snapshot\hackernews-async-ts\node_modules\egg","baseDir":"C:\snapshot\hackernews-async-ts","workers":8,"plugins":null,"https":false,"startMode":"process","ports":[],"env":null} 2023-07-21 09:57:05,728 INFO 27632 [master] start with env: isProduction: false, EGG_SERVER_ENV: null, NODE_ENV: undefined 2023-07-21 09:57:05,739 INFO 27632 [master] agent_worker#1:33332 start with clusterPort:55734 2023-07-21 09:57:06,148 ERROR 33332 nodejs.MODULE_NOT_FOUNDError: [egg-core] load file: C:\snapshot\hackernews-async-ts\node_modules\egg-security\app\extend\context.js, error: Cannot find module 'C:\snapshot\hackernews-async-ts\node_modules\egg-security\node_modules\nanoid\non-secure\index.cjs' 1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath. 1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath. at createEsmNotFoundErr (node:internal/modules/cjs/loader:960:15) at finalizeEsmResolution (node:internal/modules/cjs/loader:953:15) at resolveExports (node:internal/modules/cjs/loader:482:14) at Function.Module._findPath (node:internal/modules/cjs/loader:522:31) at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27) at Function._resolveFilename (pkg/prelude/bootstrap.js:1951:46) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at Module.require (pkg/prelude/bootstrap.js:1851:31) at require (node:internal/modules/cjs/helpers:102:18) code: "MODULE_NOT_FOUND" path: "C:\snapshot\hackernews-async-ts\node_modules\egg-security\node_modules\nanoid\package.json" pkg: true name: "MODULE_NOT_FOUNDError" pid: 33332 hostname: DESKTOP-BQ61PUE

C:\snapshot\hackernews-async-ts\node_modules\egg-cluster\lib\agent_worker.js:38 throw err; ^

Error [MODULE_NOT_FOUNDError]: [egg-core] load file: C:\snapshot\hackernews-async-ts\node_modules\egg-security\app\extend\context.js, error: Cannot find module 'C:\snapshot\hackernews-async-ts\node_modules\egg-security\node_modules\nanoid\non-secure\index.cjs' 1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath. at createEsmNotFoundErr (node:internal/modules/cjs/loader:960:15) at finalizeEsmResolution (node:internal/modules/cjs/loader:953:15) at resolveExports (node:internal/modules/cjs/loader:482:14) at Function.Module._findPath (node:internal/modules/cjs/loader:522:31) at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27) at Function._resolveFilename (pkg/prelude/bootstrap.js:1951:46) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at Module.require (pkg/prelude/bootstrap.js:1851:31) at require (node:internal/modules/cjs/helpers:102:18) { code: 'MODULE_NOT_FOUND', path: 'C:\snapshot\hackernews-async-ts\node_modules\egg-security\node_modules\nanoid\package.json', pkg: true } 2023-07-21 09:57:06,165 ERROR 27632 nodejs.AgentWorkerDiedError: [master] agent_worker#1:33332 died (code: 1, signal: null) at Master.onAgentExit (C:\snapshot\hackernews-async-ts\node_modules\egg-cluster\lib\master.js:325:17) at Master.emit (node:events:527:28) at Messenger.sendToMaster (C:\snapshot\hackernews-async-ts\node_modules\egg-cluster\lib\utils\messenger.js:137:17) at Messenger.send (C:\snapshot\hackernews-async-ts\node_modules\egg-cluster\lib\utils\messenger.js:102:12) at ChildProcess. (C:\snapshot\hackernews-async-ts\node_modules\egg-cluster\lib\utils\mode\impl\process\agent.js:89:22) at Object.onceWrapper (node:events:642:26) at ChildProcess.emit (node:events:527:28) at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12) name: "AgentWorkerDiedError" pid: 27632 hostname: DESKTOP-BQ61PUE

2023-07-21 09:57:06,166 ERROR 27632 [master] agent_worker#1:33332 start fail, exiting with code:1 2023-07-21 09:57:06,166 ERROR 27632 [master] exit with code:1

pxim commented 1 year ago

[egg-core] load file: C:\snapshot\hackernews-async-ts\node_modules\egg-security\app\extend\context.js, error: Cannot find module 'C:\snapshot\hackernews-async-ts\node_modules\egg-security\node_modules\nanoid\non-secure\index.cjs'

为什么会有这种错误?node_modules\egg-security\node_modules,

XxElza commented 2 months ago

我也碰到了这个问题。请问解决了嘛 orz orz