NPM错误解析Json,意外令牌

Jae*_*lee 7 json node.js npm

我正在尝试安装grunt,但没有运气.

npm install -g grunt-cli --registry http://registry.npmjs.org/
Run Code Online (Sandbox Code Playgroud)

给出了这个错误:

npm ERR! registry error parsing json
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "grunt-cli" "--registry" "http://registry.npmjs.org/"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! Unexpected token <
npm ERR! <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
npm ERR! <html><head>
npm ERR! <title>404 Not Found</title>
npm ERR! </head><body>
npm ERR! <h1>Not Found</h1>
npm ERR! <p>The requested URL /grunt-cli was not found on this server.</p>
npm ERR! </body></html>
Run Code Online (Sandbox Code Playgroud)

可能有什么不对?

rfl*_*myk 28

我刚刚运行命令,

第一:

$ rm -f package-lock.json

后:

$ npm i

为我工作;)


Jae*_*lee 20

这为我做了,虽然不知道为什么.

npm config rm proxy
npm config rm https-proxy
Run Code Online (Sandbox Code Playgroud)

http://jonathanblog2000.blogspot.ch/2013/11/set-and-reset-proxy-for-git-and-npm.html

  • 对我有用的是`rm package-log.json` (3认同)
  • @TylerChong`rm -f package-lock.json && npm install` (3认同)