0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

'MODULE_NOT_FOUND' node.jsでnpm/nodemon startしたらエラーが出た【自分用】

Posted at

環境など

  • win10
  • vscode
  • node.js
  • express
  • http(これをインストールし忘れていた)

上記サイトを最後まで行ったため自分で、簡単なwebappを作成しようと環境を構築しているところエラーが出た。おそらく慣れるまでは、上記サイトを参考にするため、時間が空くとまた同じエラーを発生させそうなため、ここに記述しておく。

errorMessage

errorMessage
Error: Cannot find module 'http-errors'
Require stack:
- C:\node-workspase\8\kakeibo\app.js
- C:\node-workspase\8\kakeibo\bin\www
    at Module._resolveFilename (node:internal/modules/cjs/loader:1047:15)
    at Module._load (node:internal/modules/cjs/loader:893:27)
    at Module.require (node:internal/modules/cjs/loader:1113:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (C:\node-workspase\8\kakeibo\app.js:1:19)
    at Module._compile (node:internal/modules/cjs/loader:1226:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1280:10)
    at Module.load (node:internal/modules/cjs/loader:1089:32)
    at Module._load (node:internal/modules/cjs/loader:930:12)
    at Module.require (node:internal/modules/cjs/loader:1113:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\node-workspase\\8\\kakeibo\\app.js',
    'C:\\node-workspase\\8\\kakeibo\\bin\\www'
  ]
}

Node.js v18.14.0

Error: Cannot find module 'http-errors' code: 'MODULE_NOT_FOUND',とある様に http モジュールがインストールされていなかった。

単純な話であるが、サイトでは、それまでにhttpモジュールをインストールしていることもあり、見のがしていた。

解決法

cmd
npm install http
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?