尝试在Mac上安装npm时出现奇怪错误

时间:2011-07-26 23:43:16

标签: node.js npm

尝试使用Xcode 3.2在mac os x 10.6.6上安装npm时出现以下错误。我该如何解决这个问题?

MacPro:juggernaut fred$ curl http://npmjs.org/install.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3902  100  3902    0     0   4114      0 --:--:-- --:--:-- --:--:--  7898
fetching: http://registry.npmjs.org/npm/-/npm-1.0.22.tgz

node.js:63
    throw e;
    ^
Error: Cannot find module 'graceful-fs'
    at loadModule (node.js:275:15)
    at require (node.js:411:14)
    at Object.<anonymous> (/private/var/folders/Da/DabGxbDzFA8Fcw2FWL3FpE+++TI/-Tmp-/npm.53508/package/lib/utils/read-json.js:7:10)
    at Module._compile (node.js:462:23)
    at Module._loadScriptSync (node.js:469:10)
    at Module.loadSync (node.js:338:12)
    at loadModule (node.js:283:14)
    at require (node.js:411:14)
    at Object.<anonymous> (/private/var/folders/Da/DabGxbDzFA8Fcw2FWL3FpE+++TI/-Tmp-/npm.53508/package/bin/read-package-json.js:9:16)
    at Module._compile (node.js:462:23)
0.2.5

node.js:63
    throw e;
    ^
Error: Cannot find module 'graceful-fs'
    at loadModule (node.js:275:15)
    at require (node.js:411:14)
    at Object.<anonymous> (/private/var/folders/Da/DabGxbDzFA8Fcw2FWL3FpE+++TI/-Tmp-/npm.53508/package/lib/utils/read-json.js:7:10)
    at Module._compile (node.js:462:23)
    at Module._loadScriptSync (node.js:469:10)
    at Module.loadSync (node.js:338:12)
    at loadModule (node.js:283:14)
    at require (node.js:411:14)
    at Object.<anonymous> (/private/var/folders/Da/DabGxbDzFA8Fcw2FWL3FpE+++TI/-Tmp-/npm.53508/package/bin/read-package-json.js:9:16)
    at Module._compile (node.js:462:23)

node.js:63
    throw e;
    ^
Error: Cannot find module 'graceful-fs'
    at loadModule (node.js:275:15)
    at require (node.js:411:14)
    at Object.<anonymous> (/private/var/folders/Da/DabGxbDzFA8Fcw2FWL3FpE+++TI/-Tmp-/npm.53508/package/lib/utils/read-json.js:7:10)
    at Module._compile (node.js:462:23)
    at Module._loadScriptSync (node.js:469:10)
    at Module.loadSync (node.js:338:12)
    at loadModule (node.js:283:14)
    at require (node.js:411:14)
    at Object.<anonymous> (/private/var/folders/Da/DabGxbDzFA8Fcw2FWL3FpE+++TI/-Tmp-/npm.53508/package/bin/read-package-json.js:9:16)
    at Module._compile (node.js:462:23)
! [ -d .git ] || git submodule update --init --recursive
node cli.js cache clean

node.js:63
    throw e;
    ^
Error: Cannot find module 'graceful-fs'
    at loadModule (node.js:275:15)
    at require (node.js:411:14)
    at Object.<anonymous> (/private/var/folders/Da/DabGxbDzFA8Fcw2FWL3FpE+++TI/-Tmp-/npm.53508/package/lib/utils/ini.js:31:10)
    at Module._compile (node.js:462:23)
    at Module._loadScriptSync (node.js:469:10)
    at Module.loadSync (node.js:338:12)
    at loadModule (node.js:283:14)
    at require (node.js:411:14)
    at Object.<anonymous> (/private/var/folders/Da/DabGxbDzFA8Fcw2FWL3FpE+++TI/-Tmp-/npm.53508/package/lib/config.js:10:11)
    at Module._compile (node.js:462:23)
make: *** [uninstall] Error 1

node.js:63
    throw e;
    ^
Error: Cannot find module 'graceful-fs'
    at loadModule (node.js:275:15)
    at require (node.js:411:14)
    at Object.<anonymous> (/private/var/folders/Da/DabGxbDzFA8Fcw2FWL3FpE+++TI/-Tmp-/npm.53508/package/lib/utils/ini.js:31:10)
    at Module._compile (node.js:462:23)
    at Module._loadScriptSync (node.js:469:10)
    at Module.loadSync (node.js:338:12)
    at loadModule (node.js:283:14)
    at require (node.js:411:14)
    at Object.<anonymous> (/private/var/folders/Da/DabGxbDzFA8Fcw2FWL3FpE+++TI/-Tmp-/npm.53508/package/lib/config.js:10:11)
    at Module._compile (node.js:462:23)

node.js:63
    throw e;
    ^
Error: Cannot find module 'graceful-fs'
    at loadModule (node.js:275:15)
    at require (node.js:411:14)
    at Object.<anonymous> (/private/var/folders/Da/DabGxbDzFA8Fcw2FWL3FpE+++TI/-Tmp-/npm.53508/package/lib/utils/ini.js:31:10)
    at Module._compile (node.js:462:23)
    at Module._loadScriptSync (node.js:469:10)
    at Module.loadSync (node.js:338:12)
    at loadModule (node.js:283:14)
    at require (node.js:411:14)
    at Object.<anonymous> (/private/var/folders/Da/DabGxbDzFA8Fcw2FWL3FpE+++TI/-Tmp-/npm.53508/package/lib/config.js:10:11)
    at Module._compile (node.js:462:23)

node.js:63
    throw e;
    ^
Error: Cannot find module 'graceful-fs'
    at loadModule (node.js:275:15)
    at require (node.js:411:14)
    at Object.<anonymous> (/private/var/folders/Da/DabGxbDzFA8Fcw2FWL3FpE+++TI/-Tmp-/npm.53508/package/lib/utils/ini.js:31:10)
    at Module._compile (node.js:462:23)
    at Module._loadScriptSync (node.js:469:10)
    at Module.loadSync (node.js:338:12)
    at loadModule (node.js:283:14)
    at require (node.js:411:14)
    at Object.<anonymous> (/private/var/folders/Da/DabGxbDzFA8Fcw2FWL3FpE+++TI/-Tmp-/npm.53508/package/lib/config.js:10:11)
    at Module._compile (node.js:462:23)
It failed
MacPro:juggernaut fred$ 

3 个答案:

答案 0 :(得分:3)

听起来您正在运行旧版本的节点。最新的npm需要节点v0.4及更高版本。

答案 1 :(得分:0)

在尝试安装软件包时,如果缺少软件包,似乎有点向后。

解决方法可能是手动安装gracefull-fs https://github.com/isaacs/node-graceful-fs

答案 2 :(得分:0)

我建议你使用这些软件包安装node和npm:https://sites.google.com/site/nodejsmacosx/

这样你就可以确保node和npm匹配。

卸载当前的nodejs版本可能是一个好主意。