2017-06-22 60 views
0

尝试安装聚合物CLI时出现此错误。每当我尝试安装它时,我都会继续收到此信息。聚合物CLI - npm错误代码1

sudo npm install --unsafe-perm -g polymer-cli 
Password: 
npm WARN deprecated [email protected]: ..psst! While Bower is maintained, we 
recommend Yarn and Webpack for *new* front-end projects! Yarn's 
advantage is security and reliability, and Webpack's is support for 
both CommonJS and AMD projects. Currently there's no migration path but 
we hope you'll help us figure out one. 
npm WARN deprecated @types/[email protected]: See 
https://github.com/DefinitelyTyped/DefinitelyTyped/issues/12826 
npm ERR! code 1 
npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b master 
git://github.com/polymerelements/test-fixture.git 
/Users/litsonthomas/.npm/_cacache/tmp/git-clone-eddd277b 
npm ERR! /Users/litsonthomas/.npm/_cacache/tmp/git-clone-eddd277b/.git: 
Permission denied 
npm ERR! 

npm ERR! A complete log of this run can be found in: 
npm ERR!  /Users/litsonthomas/.npm/_logs/2017-06-22T17_39_34_600Z- 
debug.log 

我是聚合物的新手,我不知道哪里出错!

+0

你能指定你的npm版本吗? –

+0

npm版本是5.0.3 –

回答

0

这似乎是这个包中的一个相关问题(存储库中的问题:#784#800)。您必须前往Fixing npm Permissions的npm网站,并按照该处的步骤操作。

当您尝试全局安装软件包时,可能会收到EACCES错误。这表明您没有权限写入npm用来存储全局程序包和命令的目录。

您可以修复使用三个选项这个问题:

  1. 更改权限故宫的默认目录。
  2. 将npm的默认目录更改为另一个目录。
  3. 安装节点与一个包管理器,为您照顾这件事。

是否应该按照三个选项之一取决于每个特定的情况。我首先推荐的是尝试将npm默认目录更改为具有用户读/写权限的某个位置。然后,你应该开始做npm i -g没有sudo