Node.js无法启动服务器

时间:2016-09-21 02:00:14

标签: node.js express npm

我很困惑a)这里的实际错误是什么 - 似乎有一些缺少该模块的人仍然可以启动他们的服务器,b)我该如何解决这个问题?

我试过了:

rm -rf node_modules
npm cache clean
npm install

npm-debug.log没有提供其他错误/明显有用的信息。这是一个使用Express的初学者设置,可以对MongoDB进行小型查询。

npm开始输出:

david@david-desktop:~/Documents/node/nodetest1$ npm start

> nodetest1@0.0.0 start /home/david/Documents/node/nodetest1
> node ./bin/www

{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
Port 3000 is already in use

npm ERR! Linux 4.4.0-36-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v4.5.0
npm ERR! npm  v3.10.7
npm ERR! code ELIFECYCLE
npm ERR! nodetest1@0.0.0 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the nodetest1@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 nodetest1 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 nodetest1
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls nodetest1
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/david/Documents/node/nodetest1/npm-debug.log

2 个答案:

答案 0 :(得分:0)

Port 3000 is already in use

请尝试终止在端口3000上运行的旧进程或尝试使用其他端口。

答案 1 :(得分:0)

您可以参考此文章来终止在端口号3000上运行的进程

Find (and kill) process locking port 3000 on Mac

否则,更改端口号