无法安装Phonegap

时间:2014-03-01 06:15:37

标签: node.js cordova

我正在尝试使用sudo npm install -g phonegap在我的mac上安装phonegap。 我一直在犯这个错误:

npm ERR! TypeError: Object #<Object> has no method 'match'
npm ERR!     at Object.scriptpath_ (/Users/admin/npm/node_modules/read-package-json/read-json.js:138:23)
npm ERR!     at Array.forEach (native)
npm ERR!     at scriptpath (/Users/admin/npm/node_modules/read-package-json/read-json.js:132:19)
npm ERR!     at /Users/admin/npm/node_modules/read-package-json/read-json.js:119:33
npm ERR!     at Array.forEach (native)
npm ERR!     at extras (/Users/admin/npm/node_modules/read-package-json/read-json.js:118:21)
npm ERR!     at parseJson (/Users/admin/npm/node_modules/read-package-json/read-json.js:87:17)
npm ERR!     at /Users/admin/npm/node_modules/read-package-json/read-json.js:59:33
npm ERR!     at fs.js:266:14
npm ERR!     at /Users/admin/npm/node_modules/graceful-fs/graceful-fs.js:103:5
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/isaacs/npm/issues>

npm ERR! System Darwin 12.5.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "phonegap"
npm ERR! cwd /Users/admin
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.3.23
npm ERR! type undefined_method

npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/admin/npm-debug.log
npm ERR! not ok code 0

有什么问题?

2 个答案:

答案 0 :(得分:0)

O.K thisthis是解决此错误需要采取的行动。

答案 1 :(得分:0)

你需要更新你的npm,这是macOSX上的命令npm -g install npm@latest