简体   繁体   English

不确定为什么我会收到错误以及为什么它在启动 express.js 时没有启动

[英]Unsure as to why I'm getting an error and why it doesn't start upon starting express.js

My express.js is unable to start upon typing npm start and I don't understand why it's happening, here's my error log:我的 express.js 在输入npm start时无法启动,我不明白为什么会这样,这是我的错误日志:

C:\Users\simer\Desktop\API-workshop>npm start

> api-workshop@0.0.0 start C:\Users\simer\Desktop\API-workshop
> node ./bin/www

internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module 'http-errors'
Require stack:
- C:\Users\simer\Desktop\API-workshop\app.js
- C:\Users\simer\Desktop\API-workshop\bin\www
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (C:\Users\simer\Desktop\API-workshop\app.js:1:19)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:14)
    at Module.require (internal/modules/cjs/loader.js:974:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\simer\\Desktop\\API-workshop\\app.js',
    'C:\\Users\\simer\\Desktop\\API-workshop\\bin\\www'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! api-workshop@0.0.0 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the api-workshop@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\simer\AppData\Roaming\npm-cache\_logs\2022-01-19T21_07_47_160Z-debug.log

Does anyone know what I should do?有谁知道我应该怎么做?

You need to install Your package - http-errors in root project directory.您需要在根项目目录中安装您的package - http-errors

  1. npm install http-errors
  2. Try to run again npm start再次尝试运行npm start

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM