NodeJS无法找到模块

时间:2016-09-07 20:47:51

标签: javascript node.js

我的同事告诉我结账他正在做的Git回购。

该应用使用NodeJS。我做了“git clone”然后“npm install”。我的同事告诉我然后运行“npm start”。我试过这个,但是我收到了一个错误。我们认为问题是我的旧版Node。他正在运行第4版,我重新回到0.6。

所以我升级了。我在Mac上。我使用Homebrew卸载了Node,然后使用Homebrew重新安装了Node。

现在:

  node -v
  v6.5.0

所以现在我做“npm install”然后“npm start”。现在我得到了一个不同的错误:

  npm start

  > api-reference@0.0.1 start /Users/lLRK9/projects/zeria/api
  > node server.js

  module.js:457
      throw err;
      ^

  Error: Cannot find module './config/manifest.json'
      at Function.Module._resolveFilename (module.js:455:15)
      at Function.Module._load (module.js:403:25)
      at Module.require (module.js:483:17)
      at require (internal/module.js:20:19)
      at Object.<anonymous> (/Users/lLRK9/projects/zeria/api/server.js:5:18)
      at Module._compile (module.js:556:32)
      at Object.Module._extensions..js (module.js:565:10)
      at Module.load (module.js:473:32)
      at tryModuleLoad (module.js:432:12)
      at Function.Module._load (module.js:424:3)

  npm ERR! Darwin 15.6.0
  npm ERR! argv "/usr/local/Cellar/node/6.5.0/bin/node" "/usr/local/bin/npm" "start"
  npm ERR! node v6.5.0
  npm ERR! npm  v3.10.3
  npm ERR! code ELIFECYCLE
  npm ERR! api-reference@0.0.1 start: `node server.js`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the api-reference@0.0.1 start script 'node server.js'.
  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 api-reference package,
  npm ERR! not with npm itself.
  npm ERR! Tell the author that this fails on your system:
  npm ERR!     node server.js
  npm ERR! You can get information on how to open an issue for this project with:
  npm ERR!     npm bugs api-reference
  npm ERR! Or if that isn't available, you can get their info via:
  npm ERR!     npm owner ls api-reference
  npm ERR! There is likely additional logging output above. 
  npm ERR! Please include the following file with any support request:
  npm ERR!     /Users/lLRK9/projects/zeria/api/npm-debug.log



  cat /Users/lLRK9/projects/zeria/api/npm-debug.log
  0 info it worked if it ends with ok
  1 verbose cli [ '/usr/local/Cellar/node/6.5.0/bin/node',
  1 verbose cli   '/usr/local/bin/npm',
  1 verbose cli   'start' ]
  2 info using npm@3.10.3
  3 info using node@v6.5.0
  4 verbose run-script [ 'prestart', 'start', 'poststart' ]
  5 info lifecycle api-reference@0.0.1~prestart: api-reference@0.0.1
  6 silly lifecycle api-reference@0.0.1~prestart: no script for prestart, continuing
  7 info lifecycle api-reference@0.0.1~start: api-reference@0.0.1
  8 verbose lifecycle api-reference@0.0.1~start: unsafe-perm in lifecycle true
  9 verbose lifecycle api-reference@0.0.1~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/lLRK9/projects/zeria/api/node_modules/.bin:/usr/local/Cellar/node/6.5.0/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Cellar/node/6.5.0/bin/node:/usr/local/bin/brew:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/mysql/bin
  10 verbose lifecycle api-reference@0.0.1~start: CWD: /Users/lLRK9/projects/zeria/api
  11 silly lifecycle api-reference@0.0.1~start: Args: [ '-c', 'node server.js' ]
  12 silly lifecycle api-reference@0.0.1~start: Returned: code: 1  signal: null
  13 info lifecycle api-reference@0.0.1~start: Failed to exec start script
  14 verbose stack Error: api-reference@0.0.1 start: `node server.js`
  14 verbose stack Exit status 1
  14 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:242:16)
  14 verbose stack     at emitTwo (events.js:106:13)
  14 verbose stack     at EventEmitter.emit (events.js:191:7)
  14 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
  14 verbose stack     at emitTwo (events.js:106:13)
  14 verbose stack     at ChildProcess.emit (events.js:191:7)
  14 verbose stack     at maybeClose (internal/child_process.js:877:16)
  14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
  15 verbose pkgid api-reference@0.0.1
  16 verbose cwd /Users/lLRK9/projects/zeria/api
  17 error Darwin 15.6.0
  18 error argv "/usr/local/Cellar/node/6.5.0/bin/node" "/usr/local/bin/npm" "start"
  19 error node v6.5.0
  20 error npm  v3.10.3
  21 error code ELIFECYCLE
  22 error api-reference@0.0.1 start: `node server.js`
  22 error Exit status 1
  23 error Failed at the api-reference@0.0.1 start script 'node server.js'.
  23 error Make sure you have the latest version of node.js and npm installed.
  23 error If you do, this is most likely a problem with the api-reference package,
  23 error not with npm itself.
  23 error Tell the author that this fails on your system:
  23 error     node server.js
  23 error You can get information on how to open an issue for this project with:
  23 error     npm bugs api-reference
  23 error Or if that isn't available, you can get their info via:
  23 error     npm owner ls api-reference
  23 error There is likely additional logging output above.
  24 verbose exit [ 1, true ]

此应用适用于我的同事。我们的设置有什么不同可能允许这个应用程序为他工作,但不适合我?

1 个答案:

答案 0 :(得分:0)

Error: Cannot find module './config/manifest.json'

这看起来像您丢失的一些本地配置文件。你应该问他。

或者,如果模块的install中存在package.json挂钩,则可能会尝试自动配置此manifest.json文件,并且可能会安装脚本失败了。您应该检查是否还有任何自定义install挂钩。

(另外,我建议将来使用n来管理Node.js版本。)