linux - 在 Ubuntu 上设置 Angular CLI

标签 linux angular-cli

我正在开发 xubuntu 16.04 LTS 版本,我正在尝试在我的机器上安装 Angular cli。我已经尝试删除、清理 npm 缓存,然后重新安装,但这不起作用。当我在控制台中编写 npm install -g @angular/cli 时,出现以下错误:

$ npm install -g @angular/cli
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/@angular/cli/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 4.4.0-78-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "@angular/cli"
npm ERR! node v6.10.0
npm ERR! npm  v3.10.10
npm ERR! path /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR!     at Error (native)
npm ERR!  { Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR!     at Error (native)
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/lib/node_modules' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/papamilo/npm-debug.log

最佳答案

尝试像这样以 root 身份运行它:

$ sudo npm install -g @angular/cli

关于linux - 在 Ubuntu 上设置 Angular CLI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44114670/

相关文章:

linux - 捕获SSH客户端中的执行日志?

linux - 如何使用 awk 或 sed 将几行转置为列

linux - 如何搜索目录?

angular - 将自定义类型文件添加到 Angular CLI

javascript - 如何在我的 Angular 5 (CLI) 项目中导入和使用纯 JavaScript 文件的功能

git - 存储库不干净

java - linux 和 java 中的特殊字符($)处理

c - Linux TCP 服务器,每 X 秒向几个客户端发送 RAW 数据

angular-cli - git clone Angular Cli项目显示你不在项目中

selenium - 为什么 ng e2e 构建模块?