gpt4 book ai didi

javascript - 无法运行服务器并在命令提示符中显示错误

转载 作者:行者123 更新时间:2023-12-03 04:30:45 25 4
gpt4 key购买 nike

我尝试使用 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

node ./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 命令,然后运行 ​​npm run start

npm 安装 -

This command installs a package, and any packages that it depends on. If the package has a shrinkwrap file, the installation of dependencies will be driven by that.

By default, npm install will install all modules listed as dependencies in package.json.

关于javascript - 无法运行服务器并在命令提示符中显示错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43498471/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com