ember.js npm安装ember@2.18时出现语法错误:意外的标记〈

r3i60tvu  于 2022-11-05  发布在  其他
关注(0)|答案(1)|浏览(74)

当我尝试运行$ npm install来安装项目上的所有模块时,或者当我尝试使用$ npm install ember@2.18安装ember v 2.18时,它给我错误:

npm http GET https://www.npmjs.com/ember
npm http 200 https://www.npmjs.com/ember
npm ERR! registry error parsing json
npm ERR! SyntaxError: Unexpected token <
npm ERR!
npm ERR! <!doctype html>
npm ERR! <html>
. . .
. . .
npm ERR! </html>
npm ERR! 
npm ERR!     at Object.parse (native)
npm ERR!     at RegClient.<anonymous> (/home/felipe/.nvm/v0.8.16/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:226:23)
npm ERR!     at Request.init.self.callback (/home/felipe/.nvm/v0.8.16/lib/node_modules/npm/node_modules/request/main.js:120:22)
npm ERR!     at Request.EventEmitter.emit (events.js:99:17)
npm ERR!     at Request.<anonymous> (/home/felipe/.nvm/v0.8.16/lib/node_modules/npm/node_modules/request/main.js:648:16)
npm ERR!     at Request.EventEmitter.emit (events.js:126:20)
npm ERR!     at IncomingMessage.Request.start.self.req.self.httpModule.request.buffer (/home/felipe/.nvm/v0.8.16/lib/node_modules/npm/node_modules/request/main.js:610:14)
npm ERR!     at IncomingMessage.EventEmitter.emit (events.js:126:20)
npm ERR!     at IncomingMessage._emitEnd (http.js:366:10)
npm ERR!     at HTTPParser.parserOnMessageComplete [as onMessageComplete] (http.js:149:23)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 4.9.0-8-amd64
npm ERR! command "/home/felipe/.nvm/v0.8.16/bin/node" "/home/felipe/.nvm/v0.8.16/bin/npm" "install" "ember@2.18"
npm ERR! cwd /workspace/.../projects/...
npm ERR! node -v v0.8.16
npm ERR! npm -v 1.1.69
npm ERR! type unexpected_token
npm ERR! Error: EACCES, open 'npm-debug.log'
npm ERR!  { [Error: EACCES, open 'npm-debug.log'] errno: 3, code: 'EACCES', path: 'npm-debug.log' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 4.9.0-8-amd64
npm ERR! command "/home/felipe/.nvm/v0.8.16/bin/node" "/home/felipe/.nvm/v0.8.16/bin/npm" "install" "ember@2.18"
npm ERR! cwd /workspace/.../projects/...
npm ERR! node -v v0.8.16
npm ERR! npm -v 1.1.69
npm ERR! path npm-debug.log
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open 'npm-debug.log'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /workspace/.../projects/.../npm-debug.log
npm ERR! not ok code 0

我用sudo试过了,没有运气。
我也尝试卸载NPM和NodeJS,但也没有运气。
我该如何解决这个问题?这是NPM或NodeJS安装的问题吗?

ukxgm1gy

ukxgm1gy1#

默认的npm注册表可以在以下位置找到:

  • https://www.npmjs.com/

但是,(根据您的错误日志),您的当前设置为:

  • https://www.npmjs.com/

尝试运行以下npm-config命令来设置注册表:

$ npm config set registry https://registry.npmjs.org/

相关问题