7

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?

5
  • Any reason you're trying to specify the registry? Did you try just npm install -g grunt-cli? From the body, it looks like it can't find grunt-cli on that server. Commented Jun 12, 2015 at 19:26
  • @Brennan I did try that. it gives me this error "Error: connect ECONNREFUSED" Commented Jun 12, 2015 at 19:54
  • 1
    That's odd. I just did it and it works for me. Do you have an .npmrc or something that would change your default registry? You may also try using --registry https://registry.npmjs.org/ (note the https). Commented Jun 12, 2015 at 19:56
  • @Brennan I'm sorry, but I'm actually not sure what .npmrc is. Could that be the problem? Tried https, gave me this error "tunneling socket could not be established, cause=connect ECONNREFUSED" "in most cases you are behind a proxy or have bad network settings." Commented Jun 12, 2015 at 20:39
  • An .npmrc is a file that you can set defaults for the npm tool to use. It doesn't look like that's the issue. Are you behind some firewall or proxy as the message suggests? Commented Jun 12, 2015 at 20:46

2 Answers 2

29

I just ran the command,

first:

$ rm -f package-lock.json

after:

$ npm i

work for me ;)

Sign up to request clarification or add additional context in comments.

1 Comment

Yup, just deleted the package-lock.json file and everything starting working again.
22

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

1 Comment

@TylerChong rm -f package-lock.json && npm install

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.