eggjs / egg

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

Centos7 部署项目出错 #2591

Closed Leungkingman closed 6 years ago

Leungkingman commented 6 years ago

在mac本地执行 npm run start (egg-scripts start --daemon --title=egg-server-guzidian) 项目正常启动。 部署到服务器上执行却报这样的错:

wx20180523-155139 2x

报错信息中的 Error: Cannot find module “@mrmlnc/readdir-enhanced“ 是什么东西?? 我上一个项目用egg1.0部署都没有遇到这个错误,这要怎么解决??

egg-bot commented 6 years ago

Translation of this issue:


Centos7 deployment project error

The npm run start (egg-scripts start --daemon --title=egg-server-guzidian) project is started locally on mac. Deployed to the server to perform such an error:

wx20180523-155139 2x

Error: Cannot find module '@mrmlnc/readdir-enhanced' in the error message? ? I did not encounter this error in my previous project deployment with egg1.0, how to solve this? ?

thonatos commented 6 years ago

尝试重新安装一下依赖。

cd ${workDir}
rm -rf node_modules/
npm i
atian25 commented 6 years ago

报错日志写的很清楚了,你的依赖问题

Leungkingman commented 6 years ago

@atian25 能给出具体的解决方案吗?package.json和我本地开发的一样,安装都是直接执行npm i,安装过程也没有报错。楼上说的哪个方法删除node_nodules然后再执行npm i 也试过了,但还是报这个错

atian25 commented 6 years ago

hey, please retry after reinstall dependencies and please never lock it.

$ # reinstall deps and never lock it.
$ rm -rf node_modules yarn.lock package-lock.json
$ npm i --no-package-lock

这个跟 egg 没啥关系,就是你的 node 依赖安装问题,Node 该怎么弄就这么弄

Leungkingman commented 6 years ago

终于找到问题所在,是npm版本的问题,原来的npm版本是5.5.1,升级到5.6.0之后重新npm i 就可以了。哎,搞了我好几个小时