javascript - npm install SyntaxError: Unexpected token C - Stack Overflow

I made some changes to the npm configuration in the previous days, and now I consistently receive the s

I made some changes to the npm configuration in the previous days, and now I consistently receive the same error while trying to install any of a variety of packages. Essentially, I cannot utilize npm anymore due to what I think is a personal erroneous change to npm settings.

I have uninstalled node and npm, and re-installed, and tried the configuration settings in the npm blog, and I still get the same error. Perhaps it has to do with permissions in Cellar directory? I thought I had taken care of that previously...

It is not clear to me what is the issue and would appreciate your help very much.

Error output is below:

npm ERR! registry error parsing json
npm ERR! SyntaxError: Unexpected token C
npm ERR! Cannot GET 
npm ERR!     at Object.parse (native)
npm ERR!     at RegClient. (/usr/local/Cellar/node/0.10.26/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:203:23)
npm ERR!     at Request.self.callback (/usr/local/Cellar/node/0.10.26/lib/node_modules/npm/node_modules/request/request.js:123:22)
npm ERR!     at Request.EventEmitter.emit (events.js:98:17)
npm ERR!     at Request. (/usr/local/Cellar/node/0.10.26/lib/node_modules/npm/node_modules/request/request.js:893:14)
npm ERR!     at Request.EventEmitter.emit (events.js:117:20)
npm ERR!     at IningMessage. (/usr/local/Cellar/node/0.10.26/lib/node_modules/npm/node_modules/request/request.js:844:12)
npm ERR!     at IningMessage.EventEmitter.emit (events.js:117:20)
npm ERR!     at _stream_readable.js:920:16
npm ERR!     at process._tickCallback (node.js:415:13)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     

The output of npm config list generates:

$ npm config list
; cli configs
registry = "/"

; userconfig /Users/rfatahi/.npmrc
ca = ""
https-proxy = "http://127.0.0.1:8888/"
proxy = "http://127.0.0.1:8888/"
registry = "/"
strict-ssl = true

; builtin config undefined
prefix = "/usr/local"

; node bin location = /usr/local/Cellar/node/0.10.26/bin/node

I made some changes to the npm configuration in the previous days, and now I consistently receive the same error while trying to install any of a variety of packages. Essentially, I cannot utilize npm anymore due to what I think is a personal erroneous change to npm settings.

I have uninstalled node and npm, and re-installed, and tried the configuration settings in the npm blog, and I still get the same error. Perhaps it has to do with permissions in Cellar directory? I thought I had taken care of that previously...

It is not clear to me what is the issue and would appreciate your help very much.

Error output is below:

npm ERR! registry error parsing json
npm ERR! SyntaxError: Unexpected token C
npm ERR! Cannot GET http://registry.npmjs/node-simple-router
npm ERR!     at Object.parse (native)
npm ERR!     at RegClient. (/usr/local/Cellar/node/0.10.26/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:203:23)
npm ERR!     at Request.self.callback (/usr/local/Cellar/node/0.10.26/lib/node_modules/npm/node_modules/request/request.js:123:22)
npm ERR!     at Request.EventEmitter.emit (events.js:98:17)
npm ERR!     at Request. (/usr/local/Cellar/node/0.10.26/lib/node_modules/npm/node_modules/request/request.js:893:14)
npm ERR!     at Request.EventEmitter.emit (events.js:117:20)
npm ERR!     at IningMessage. (/usr/local/Cellar/node/0.10.26/lib/node_modules/npm/node_modules/request/request.js:844:12)
npm ERR!     at IningMessage.EventEmitter.emit (events.js:117:20)
npm ERR!     at _stream_readable.js:920:16
npm ERR!     at process._tickCallback (node.js:415:13)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     

The output of npm config list generates:

$ npm config list
; cli configs
registry = "http://registry.npmjs/"

; userconfig /Users/rfatahi/.npmrc
ca = ""
https-proxy = "http://127.0.0.1:8888/"
proxy = "http://127.0.0.1:8888/"
registry = "http://registry.npmjs/"
strict-ssl = true

; builtin config undefined
prefix = "/usr/local"

; node bin location = /usr/local/Cellar/node/0.10.26/bin/node
Share Improve this question edited Oct 3, 2020 at 23:26 Peter Mortensen 31.6k22 gold badges110 silver badges133 bronze badges asked Mar 7, 2014 at 21:57 aug2uagaug2uag 3,4353 gold badges33 silver badges54 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

If you open file /usr/local/Cellar/node/0.10.26/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js, and insert console.log(data) on the line 202 (just before JSON.parse, you will be able to see what error are you getting.

You can also get the npm configuration using npm config list and post it, or just remove your npmrc file. But I'm not sure it's a configuration issue.

Also, it's strange that you make a request over HTTP, since default URL is HTTPS. Maybe some firewall is screwing things up(?).

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745265356a4619419.html

相关推荐

  • javascript - npm install SyntaxError: Unexpected token C - Stack Overflow

    I made some changes to the npm configuration in the previous days, and now I consistently receive the s

    4小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信