admin管理员组文章数量:1417434
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/nodeShare 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
1 Answer
Reset to default 3If 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(?).
本文标签: javascriptnpm install SyntaxError Unexpected token CStack Overflow
版权声明:本文标题:javascript - npm install SyntaxError: Unexpected token C - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745265356a2650564.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论