聚合物 CLI - npm 错误代码 1



尝试安装聚合物CLI时出现此错误。每当我尝试安装它时,我都会不断得到它。

sudo npm install --unsafe-perm -g polymer-cli
Password:
npm WARN deprecated bower@1.8.0: ..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/assert@0.0.29: 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

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

这似乎是此软件包中的相关问题(存储库中的问题:#784 #800)。您必须转到修复 npm 权限上的 npm 站点并按照那里的步骤操作。

当您尝试全局安装包时,您可能会收到EACCES错误。这表示您无权写入 npm 用于存储全局包和命令的目录。

您可以使用以下三个选项之一来解决此问题:

  1. 将权限更改为 npm 的默认目录。
  2. 将 npm 的默认目录更改为另一个目录。
  3. 使用包管理器安装节点,该管理器会为您处理此问题。

是否应遵循三个选项之一取决于每个特定情况。我首先建议的是尝试将 npm 默认目录更改为具有用户读/写权限的某个位置。然后,您应该开始在没有sudo的情况下执行npm i -g

最新更新