Node.js:npm不再安装

时间:2013-02-04 21:30:57

标签: node.js npm

我不知道我做错了什么,但尝试使用npm安装模块会返回错误。我的具体例子(相同的结果,无论我想安装哪个模块):

npm install socket.io

返回:

npm ERR! TypeError: Cannot call method 'replace' of undefined
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:332:45
npm ERR!     at fs.js:117:20
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:53:5
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:62:5
npm ERR!     at Object.oncomplete (fs.js:297:15)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "socket.io"
npm ERR! cwd /Users/Hassen/www/node/btask
npm ERR! node -v v0.8.16
npm ERR! npm -v 1.1.69
npm ERR! type non_object_property_call
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/Hassen/www/node/btask/npm-debug.log
npm ERR! not ok code 0

有什么想法吗?在此先感谢:)

1 个答案:

答案 0 :(得分:3)

此错误通常是由当前目录中没有提交的.git目录引起的。

在再次尝试npm之前删除目录或至少进行一次提交。

编辑:来自this npm issue page;

  

此问题已在最新版本中修复。请更新到最新节点和npm(分别为v0.8.17和v1.2.0)

相关问题