首页 > 开发 > linux > 正文

linux下启动express项目报错,求解决?

2017-09-11 20:12:46  来源: 网友分享

在centos7中,安装好node和express,将项目代码上传,启动出错。好像是少模块,但是使用npm install 安装那个模块还是报错。

[ws@VM_86_94_centos Online-retailers]$ npm start

ds@0.0.0 start /test/projrct/Online-retailers
node ./bin/www

module.js:471

throw err;^

Error: Cannot find module 'async/each'

at Function.Module._resolveFilename (module.js:469:15)at Function.Module._load (module.js:417:25)at Module.require (module.js:497:17)at require (internal/module.js:20:19)at Object.<anonymous> (/test/projrct/Online-retailers/node_modules/_mongoose@4.11.7@mongoose/lib/schema.js:11:12)at Module._compile (module.js:570:32)at Object.Module._extensions..js (module.js:579:10)at Module.load (module.js:487:32)at tryModuleLoad (module.js:446:12)at Function.Module._load (module.js:438:3)

npm ERR! Linux 3.10.0-327.el7.x86_64
npm ERR! argv "/usr/src/node-v6.11.2-linux-x64/bin/node" "/usr/bin/npm" "start"
npm ERR! node v6.11.2
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! ds@0.0.0 start: node ./bin/www
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ds@0.0.0 start script 'node ./bin/www'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ds package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./bin/www
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ds
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ds
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /test/projrct/Online-retailers/npm-debug.log

解决方案

1、安装依赖

npm install

ps: 如果你只是缺了async这个包,那就单独装上:

npm install --save async

2、启动应用

npm start