node.js NPM 错误解析 Json,意外令牌
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30810614/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
NPM Error Parsing Json, Unexpected Token
提问by Jaeeun lee
I'm trying to install grunt, but no luck.
我正在尝试安装 grunt,但没有运气。
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?
可能有什么问题?
回答by rflmyk
I just ran the command,
我刚刚运行了命令,
first:
第一的:
$ rm -f package-lock.json
$ rm -f package-lock.json
after:
后:
$ npm i
$ npm i
work for me ;)
对我来说有效;)
回答by Jaeeun lee
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
http://jonathanblog2000.blogspot.ch/2013/11/set-and-reset-proxy-for-git-and-npm.html

