更新 angular-cli 引发错误
Posted
技术标签:
【中文标题】更新 angular-cli 引发错误【英文标题】:updating angular-cli throws error 【发布时间】:2018-04-25 03:05:26 【问题描述】:ABC$ sudo npm install -g angular-cli@latest
npm WARN deprecated angular-cli@1.0.0-beta.28.3: angular-cli has been
renamed to @angular/cli. Please update your dependencies.
npm WARN deprecated minimatch@2.0.10: Please update to minimatch
3.0.2 or higher to avoid a RegExp DoS issue
/usr/local/bin/ng -> /usr/local/lib/node_modules/angular-cli/bin/ng
> fsevents@1.1.3 install /usr/local/lib/node_modules/angular-
cli/node_modules/fsevents
> node install
node-pre-gyp ERR! Tried to download(undefined): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.1.3/fse-v1.1.3-node-v51-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for fsevents@1.1.3 and node@7.8.0 (node-v51 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! clean error
gyp ERR! stack Error: EACCES: permission denied, rmdir 'build'
gyp ERR! System Darwin 16.7.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/angular-cli/node_modules/node-gyp/bin/node-gyp.js" "clean"
gyp ERR! cwd /usr/local/lib/node_modules/angular-cli/node_modules/fsevents
gyp ERR! node -v v7.8.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/angular-cli/node_modules/node-gyp/bin/node-gyp.js clean' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/angular-cli/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:194:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:899:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Darwin 16.7.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/angular-cli/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/angular-cli/node_modules/fsevents
node-pre-gyp ERR! node -v v7.8.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
无法执行'/usr/local/bin/node /usr/local/lib/node_modules/angular-cli/node_modules/node-gyp/bin/node-gyp.js clean' (1)
node-sass@4.6.1 安装 /usr/local/lib/node_modules/angular-cli/node_modules/node-sass 节点脚本/install.js
Unable to save binary /usr/local/lib/node_modules/angular-cli/node_modules/node-sass/vendor/darwin-x64-51 : Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/angular-cli/node_modules/node-sass/vendor'
at Object.fs.mkdirSync (fs.js:895:18)
at sync (/usr/local/lib/node_modules/angular-cli/node_modules/mkdirp/index.js:71:13)
at Function.sync (/usr/local/lib/node_modules/angular-cli/node_modules/mkdirp/index.js:77:24)
at checkAndDownloadBinary (/usr/local/lib/node_modules/angular-cli/node_modules/node-sass/scripts/install.js:111:11)
at Object.<anonymous> (/usr/local/lib/node_modules/angular-cli/node_modules/node-sass/scripts/install.js:154:1)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
错误号:-13, 代码:'EACCES', 系统调用:'mkdir', 路径:'/usr/local/lib/node_modules/angular-cli/node_modules/node-sass/vendor'
node-sass@4.6.1 安装后 /usr/local/lib/node_modules/angular-cli/node_modules/node-sass 节点脚本/build.js
Building: /usr/local/bin/node /usr/local/lib/node_modules/angular-cli/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ '/usr/local/bin/node',
gyp verb cli '/usr/local/lib/node_modules/angular-cli/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library=' ]
gyp info using node-gyp@3.6.2
gyp info using node@7.8.0 | darwin | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed at getNotFoundError (/usr/local/lib/node_modules/angular-cli/node_modules/which/which.js:13:12)
gyp verb `which` failed at F (/usr/local/lib/node_modules/angular-cli/node_modules/which/which.js:68:19)
gyp verb `which` failed at E (/usr/local/lib/node_modules/angular-cli/node_modules/which/which.js:80:29)
gyp verb `which` failed at /usr/local/lib/node_modules/angular-cli/node_modules/which/which.js:89:16
gyp verb `which` failed at /usr/local/lib/node_modules/angular-cli/node_modules/isexe/index.js:42:5
gyp verb `which` failed at /usr/local/lib/node_modules/angular-cli/node_modules/isexe/mode.js:8:5
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:114:15)
gyp verb `which` failed python2 Error: not found: python2
gyp verb `which` failed at getNotFoundError (/usr/local/lib/node_modules/angular-cli/node_modules/which/which.js:13:12)
gyp verb `which` failed at F (/usr/local/lib/node_modules/angular-cli/node_modules/which/which.js:68:19)
gyp verb `which` failed at E (/usr/local/lib/node_modules/angular-cli/node_modules/which/which.js:80:29)
gyp verb `which` failed at /usr/local/lib/node_modules/angular-cli/node_modules/which/which.js:89:16
gyp verb `which` failed at /usr/local/lib/node_modules/angular-cli/node_modules/isexe/index.js:42:5
gyp verb `which` failed at /usr/local/lib/node_modules/angular-cli/node_modules/isexe/mode.js:8:5
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:114:15)
gyp verb `which` failed stack: 'Error: not found: python2\n at
getNotFoundError (/usr/local/lib/node_modules/angular-cli/node_modules/which/which.js:13:12)\n 在 F (/usr/local/lib/node_modules/angular-cli/node_modules/ which/which.js:68:19)\n 在 E (/usr/local/lib/node_modules/angular-cli/node_modules/which/which.js:80:29)\n 在 /usr/local/lib/ node_modules/angular-cli/node_modules/which/which.js:89:16\n 在 /usr/local/lib/node_modules/angular-cli/node_modules/isexe/index.js:42:5\n 在 /usr/ local/lib/node_modules/angular-cli/node_modules/isexe/mode.js:8:5\n 在 FSReqWrap.oncomplete (fs.js:114:15)',
gyp动词which
失败代码:'ENOENT'
gyp verb check python 检查 PATH 中的 Python 可执行文件“python”
gyp 动词 which
成功 python /usr/bin/python
gyp动词检查python版本/usr/bin/python -c "import platform; print(platform.python_version());"
返回:“2.7.10\n”
gyp verb get node dir no --target version specified, fall back to host node version: 7.8.0
gyp动词命令安装['7.8.0']
gyp动词安装输入版本字符串“7.8.0”
gyp动词安装安装版本:7.8.0
gyp verb install --ensure 已通过,因此如果已安装则不会重新安装
gyp动词安装版本已经安装,需要检查“installVersion”
gyp 动词得到“installVersion” 9
gyp 动词需要“installVersion” 9
gyp动词安装版本很好
gyp动词获取节点目录目标节点版本安装:7.8.0
gyp动词构建目录试图创建“构建”目录:/usr/local/lib/node_modules/angular-cli/node_modules/node-sass/build
吉普错误!配置错误
吉普错误!堆栈错误:EACCES:权限被拒绝,mkdir '/usr/local/lib/node_modules/angular-cli/node_modules/node-sass/build'
吉普错误!系统达尔文 16.7.0
吉普错误!命令“/usr/local/bin/node”“/usr/local/lib/node_modules/angular-cli/node_modules/node-gyp/bin/node-gyp.js”“重建”“--verbose”“-- libsass_ext=""--libsass_cflags=""--libsass_ldflags=""--libsass_library="
吉普错误! cwd /usr/local/lib/node_modules/angular-cli/node_modules/node-sass
吉普错误!节点-v v7.8.0
吉普错误!节点gyp -v v3.6.2
吉普错误!不好
构建失败,错误代码:1
npm WARN @angular/core@2.4.10 需要 rxjs@^5.0.1 的对等点,但没有安装。您必须自己安装对等依赖项。
npm WARN 可选跳过可选依赖:fsevents@1.1.3 (node_modules/angular-cli/node_modules/fsevents):
npm WARN 可选跳过可选依赖:fsevents@1.1.3 安装:node install
npm WARN 可选跳过可选依赖:退出状态 1
npm 错误!代码生命周期
npm 错误!错误号 1
npm 错误! node-sass@4.6.1 安装后:node scripts/build.js
npm 错误!退出状态 1
npm 错误!
npm 错误!在 node-sass@4.6.1 安装后脚本失败。
npm 错误!这可能不是 npm 的问题。上面可能还有额外的日志输出。
npm 错误!可以在以下位置找到此运行的完整日志: npm 错误! /Users/ABC/.npm/_logs/2017-11-12T09_23_09_328Z-debug.log
【问题讨论】:
安装前卸载了吗? 是的。因为我认为这将是理想的方式。 这是你的错误npm WARN deprecated angular-cli@1.0.0-beta.28.3: angular-cli has been renamed to @angular/cli.
警告已弃用 angular-cli@1.0.0-beta.28.3:angular-cli 已重命名为 @angular/cli:您使用的是废弃的 beta 版本。忘记 angular-cli,并使用维护的项目:@angular/cli。 github.com/angular/angular-cli
【参考方案1】:
您安装的 cli 版本错误。
npm WARN 已弃用 angular-cli@1.0.0-beta.28.3: angular-cli 已被 重命名为@angular/cli。
你应该这样做:
npm uninstall -global angular-cli @angular/cli
npm install -global @angular/cli
【讨论】:
从全局卸载时遇到此错误。 - npm 错误!路径 /usr/local/bin/ng npm 错误!代码 EEXIST npm 错误!拒绝删除 /usr/local/bin/ng: ../lib/node_modules/angular-cli/bin/ng 符号链接目标不受 npm /usr/local/lib/node_modules/@angular/cli npm 错误控制!文件存在:/usr/local/bin/ng npm ERR!将其移开,然后重试。 @Samir 好吧,把它移开,再试一次。以上是关于更新 angular-cli 引发错误的主要内容,如果未能解决你的问题,请参考以下文章
@angular-cli 安装失败,请求被弃用@2.88.2:请求已被弃用(mac)
IntelliJ Angular 项目在 WebStorm 中为 HTML 文件引发 TSLINT 错误