【问题标题】:Unable to run server and error displayed in command prompt无法运行服务器并在命令提示符中显示错误
【发布时间】:2017-04-19 14:21:51
【问题描述】:

我正在尝试使用 github 中的代码打开网页,但无法运行面临错误的服务器并在命令提示符中显示如下:

代码链接:https://github.com/mschwarzmueller/nodejs-basics-tutorial/tree/master/09-mongodb

错误:

05-express-first-app@0.0.0 启动 C:\Users\Atchaya\Downloads\nodejs-basics-tutorial-master\09-mongodb

节点 ./bin/www

module.js:471
    throw err;
^

Error: Cannot find module 'express'
    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> (C:\Users\Atchaya\Downloads\nodejs-basics-tutorial-master\09-mongodb\app.js:1:77)
    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! code ELIFECYCLE
npm ERR! errno 1
npm ERR! 05-express-first-app@0.0.0 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the 05-express-first-app@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 05-express-first-app 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 05-express-first-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls 05-express-first-app
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Atchaya\AppData\Roaming\npm-cache\_logs\2017-04-19T14_14_54_505Z-debug.log

【问题讨论】:

  • 你在09-mongodb文件夹中做了npm install吗?
  • @Dan 我不认为他们这样做了npm WARN Local package.json exists, but node_modules missing, did you mean to install?

标签: javascript html node.js mongodb reactjs


【解决方案1】:

转到您的09-mongodb 文件夹,然后运行npm install 命令,然后运行npm run start

npm install -

这个命令安装一个包,以及它所依赖的任何包。 如果包有shrinkwrap文件,安装依赖 将受此驱动。

默认情况下,npm install 将安装列出的所有模块 package.json 中的依赖项。

【讨论】:

  • 它运行良好......并且能够运行服务器......感谢您的回复和回答......
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-08-24
  • 2013-07-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多