NPM Error Parsing Json, Unexpected Token

2019-03-13 16:56发布

I'm trying to install grunt, but no luck.

npm install -g grunt-cli --registry http://registry.npmjs.org/

gives this error:

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>

What could be wrong?

标签: json node.js npm
2条回答
Emotional °昔
2楼-- · 2019-03-13 17:13

This did it for me, although not sure why.

npm config rm proxy
npm config rm https-proxy

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

查看更多
ら.Afraid
3楼-- · 2019-03-13 17:30

I just ran the command,

first:

$ rm -f package-lock.json

after:

$ npm i

work for me ;)

查看更多
登录 后发表回答