0

I am facing the problem related to npm install and have tried all the registry command but still not able to solve the problem

npm timing stage:rollbackFailedOptional Completed in 0ms
    npm timing stage:runTopLevelLifecycles Completed in 2109ms
    npm verb stack SyntaxError: Unexpected token < in JSON at position 0 while parsing near '<HTML><HEAD>
    npm verb stack                          <T...'
    npm verb stack     at JSON.parse (<anonymous>)
    npm verb stack     at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
    npm verb stack     at consumeBody.call.then.buffer (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50)
    npm verb stack     at process._tickCallback (internal/process/next_tick.js:68:7)
    npm verb cwd C:\mylearn\react-app\simple-react-full-stack-master
    npm verb Windows_NT 10.0.17134
    npm verb argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
    npm verb node v10.15.0
    npm verb npm  v6.4.1
    npm ERR! Unexpected token < in JSON at position 0 while parsing near '<HTML><HEAD>
    npm ERR!                                <T...'
    npm verb exit [ 1, true ]
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Smruti
  • 1
  • 1
  • Please provide me some inputs – Smruti Mar 17 '19 at 09:56
  • 2
    It's likely there's some kind of proxy between you and the NPM registry, so you're getting HTML instead of the JSON it expects. But beyond that it's hard to say what exactly the problem is. – jonrsharpe Mar 17 '19 at 10:00

1 Answers1

0

as jonrsharpe pointed out, it looks like you are behind some kind of firewall or proxy which is blocking the requests to the npm registry. thats why its returning HTML (some redirect / forbidden possibly).

Check out this answer from a similar post Running npm behind a corporate firewall: what do I need to tell the security team?

npm config set proxy http://company.com:8000 or

npm config set https-proxy http://company.com:8000 where http://company.com:8000 is your proxy server and port

tritium_3
  • 648
  • 1
  • 8
  • 17