1
Error: Cannot find module 'once'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/nodemon/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/got/node_modules/duplexify/node_modules/end-of-stream/index.js:1:74)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)

当我尝试server.js使用 nodemon 运行时出现此错误。我查看了我的node_modules文件夹,那里有一个“曾经”文件夹。我试过了

rm -rf node_modules
npm install

删除整个node_modules文件夹并重新安装,但它没有用。我也做过

npm install --save once

仍然没有工作。

这是 package.json

{
  "name": "FullMean_Friends",
  "version": "0.0.1",
  "scripts": {
    "start": "node server.js"
  },
  "dependencies": {
    "body-parser": "latest",
    "express": "~4.2.0",
    "mongoose": "latest"
  }
}
4

0 回答 0