当前位置: 首页 > 工具软件 > nodemon > 使用案例 >

nodemon报错

韦胜泫
2023-12-01

报错:[nodemon] app crashed - waiting for file changes before starting...

安装完serve-static后nodemon报错,我后来卸了重新安装就好了。

原因:可能是顺序错了吧。1.安装serve-static --> 2.导入serve-static --> 3.使用serve-static

我是导入使用完成之后保存了,才想起来没有安装。

[nodemon] starting `node index.js`
internal/modules/cjs/loader.js:905
  throw err;
  ^
Error: Cannot find module 'depd'
Require stack:
- D:\briup\5-校园兼职\3-后端接口\app02\node_modules\body-parser\index.js
- D:\briup\5-校园兼职\3-后端接口\app02\node_modules\express\lib\express.js
- D:\briup\5-校园兼职\3-后端接口\app02\node_modules\express\index.js
- D:\briup\5-校园兼职\3-后端接口\app02\index.js
    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> (D:\briup\5-校园兼职\3-后端接口\app02\node_modules\body-parser\index.js:14:17)
    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: [
    'D:\\briup\\5-校园兼职\\3-后端接口\\app02\\node_modules\\body-parser\\index.js',
    'D:\\briup\\5-校园兼职\\3-后端接口\\app02\\node_modules\\express\\lib\\express.js',
    'D:\\briup\\5-校园兼职\\3-后端接口\\app02\\node_modules\\express\\index.js',
    'D:\\briup\\5-校园兼职\\3-后端接口\\app02\\index.js'
  ]
}
[nodemon] app crashed - waiting for file changes before starting...

 卸载serve-static之后重新安装,就没问题了

PS D:\briup\5-校园兼职\3-后端接口\app02> cnpm i serve-static
√ Installed 1 packages
√ Linked 20 latest versions
√ Run 0 scripts
√ All packages installed (21 packages installed from npm registry, used 1s(network 1s), speed 52.01KB/s, json 20(70.21KB), tarball 0B)    
PS D:\briup\5-校园兼职\3-后端接口\app02> nodemon index.js
[nodemon] 2.0.15
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node index.js`
3000 server is running

 

 类似资料: