您好,我在部署生产环境的时候,启动项目egg-scripts start 出现了如下问题,手动删除 node_modules 之后,在执行 npm install,然后在执行egg-scripts start 就没问题,我想问问,这个应该什么原因导致的!
egg-scripts start --env=prod --workers=4 --daemon --title=XXXXX-permission-system-node
module.js:491
throw err;
^
Error: Cannot find module '..'
at Function.Module._resolveFilename (module.js:489:15)
at Function.Module._load (module.js:439:25)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object.
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] server_prod: egg-scripts start --env=prod --workers=4 --daemon --title=XXXXX-permission-system-node
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] server_prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Translation of this issue:
Hello, when I deploy the production environment, the following problems occur in the startup project egg-scripts start. After manually deleting the node_modules and executing npm install, then there is no problem in executing the egg-scripts start. I would like to ask, this should be What causes it!
Egg-scripts start --env=prod --workers=4 --daemon --title=XXXXX-permission-system-node
Module.js:491
Throw err;
^
Error: Cannot find module '..'
At Function.Module._resolveFilename (module.js:489:15)
At Function.Module._load (module.js:439:25)
At Module.require (module.js:517:17)
At require (internal/module.js:11:18)
At Object.
At Module._compile (module.js:573:30)
At Object.Module._extensions..js (module.js:584:10)
At Module.load (module.js:507:32)
At tryModuleLoad (module.js:470:12)
At Function.Module._load (module.js:462:3)
Npm ERR! code ELIFECYCLE
Npm ERR! errno 1
Npm ERR! [email protected] server_prod: egg-scripts start --env=prod --workers=4 --daemon --title=XXXXX-permission-system-node
Npm ERR! Exit status 1
Npm ERR!
Npm ERR! Failed at the [email protected] server_prod script.
Npm ERR! This is probably not a problem with npm. There is also more likely logging output above.
大概率是打包的问题,你们 zip 或 tar 的时候,多了一个参数,导致 node_modules/.bin/egg-script 软链变为硬链了。
@atian25
我用jenkins发布代码到服务器上运行也是这个问题
Error: Cannot find module '..'
怎么解决好呢??
仔细看上面的讨论
仔细看上面的讨论
老哥,这个问题咋解决啊, 上面只提到软链接变硬链接了
你让它不变为硬链接就好了,看你们的打包脚本的帮助文档,多了参数
Most helpful comment
你让它不变为硬链接就好了,看你们的打包脚本的帮助文档,多了参数