Angular报错-Error: ENOENT: no such file or directory, scandir '/Users/echo_hx/node_modules'
2019-11-07 更新
我知道为啥报错了,自我好好反省一下!!!
所以,Mac的终端,不能用简写的命令,哭泣。。。
不过下面的,就可以看作安装卸载@angular/cli了
在全局安装angular-cli且成功之后,查看ng v ,报错了Error: ENOENT: no such file or directory, scandir '/Users/echo_hx/node_modules'。。。。
我去查了日志,如下:
[error] Error: ENOENT: no such file or directory, scandir '/Users/echo_hx/node_modules'at Object.readdirSync (fs.js:854:3)at VersionCommand.run (/usr/local/lib/node_modules/@angular/cli/commands/version-impl.js:50:41)at VersionCommand.validateAndRun (/usr/local/lib/node_modules/@angular/cli/models/command.js:134:39)at async Object.runCommand (/usr/local/lib/node_modules/@angular/cli/models/command-runner.js:186:24)at async default_1 (/usr/local/lib/node_modules/@angular/cli/lib/cli/index.js:54:31)
我百度了,也没找到实用的方法。它们总是node-sass安装问题,头秃。于是,我只能卸载重装了,一般npm也会产生不可预料的未知错误,所以也要安装cnpm,用yarn也行。
1.重装angular-cli
npm uninstall -g @angular/cli
再清一下缓存
npm cache clean --force
若清空缓存时出现错误,执行以下命令,要么没权限啥的,用sudo
npm cache clear --force && npm install --no-shrinkwrap --update-binary
2.设置淘宝代理,以安装cnpm。cnpm可代替npm,命令格式相同。
npm config rm proxy
npm config rm https-proxy
sudo npm install cnpm -g --registry=https://registry.npm.taobao.org
3.然后安装Angular-cli
cnpm install -g @angular/cli@latest
最后,ng v 查看版本
OK,,,完美……^ _ ^
参考文章:全局安装 Angular CLI
Angular报错-Error: ENOENT: no such file or directory, scandir '/Users/echo_hx/node_modules'相关推荐
- GitBook运行报错 - Error: ENOENT: no such file or directory, stat
换一台电脑打开GitBook项目居然运行不了,gitbook serve和gitbook build都报错. Error: ENOENT: no such file or directory, sta ...
- 解决Error: ENOENT: no such file or directory, scandir 安装node-sass报错
webpack打包时出现 Error: ENOENT: no such file or directory, scandir 解决方案是执行以下方法: npm rebuild node-sass 可是 ...
- Module build failed: Error: ENOENT: no such file or directory, scandir node_modules\node-sass\vendor
npm install 报错 Module build failed: Error: ENOENT: no such file or directory, scandir 'D:\workspaces ...
- 解决Error: ENOENT: no such file or directory, scandir
解决Error: ENOENT: no such file or directory, scandir 'xxx\node-sass\vendor' 前端项目持续部署打包中出现一个奇怪的问题,记录一下 ...
- 【已解决】Error: ENOENT: no such file or directory, open ‘F:\xxx\node_modules\echarts
背景 最近在做毕设项目的时候,需要用到 echarts 来渲染数据,突然遇到这个错误 Error: ENOENT: no such file or directory, open 'F:\xxx\no ...
- Module build failed: Error: ENOENT: no such file or directory, scandir ‘C:\Users\admin\Desktop\GB\ne
Module build failed: Error: ENOENT: no such file or directory, scandir 'C:\Users\admin\Desktop\GB\ne ...
- 解决Error: ENOENT: no such file or directory, scandir ‘xxx\node-sass\vendor‘
- vue启动报错Module build failed: Error: ENOENT: no such file or directory
vue启动项目报错,一大坨 如下 Module build failed: Error: ENOENT: no such file or directory, scandir '/Users/son ...
- 配置eslint+prettier报错Error: Cannot read config file: /Users/qiandingwei/Documents/projects/creams-main
安装eslint和prettier后出现如下报错 Error: Cannot read config file: /Users/qiandingwei/Documents/projects/cream ...
最新文章
- delphi memo 行数 自动换行_大咖分享办公秘籍:Word和Excel换行
- Thinking in work
- 框架:SpringMVC中Interceptor拦截器的两种实现
- STM32开发 -- 添加头文件
- boost::geometry::concepts::check用法的测试程序
- session原理及实现共享
- Centos7 Kubernetes(k8s) 开发服务器(单服务器)部署 mariadb/mysql 数据库
- Unity 用ml-agents机器学习造个游戏AI吧(1)(Windows环境配置)
- 变量声明和定义及extern 转载
- 【板栗糖GIS】Win11如何取消打印机任务
- 小程序最新获取头像和昵称
- 北师大计算机学院保研,北师大信息科学与技术学院保研-北京师范大学信息科学与技术学院保研推荐免试研究生方法...
- python二级题库 第四套
- 关于对比损失(contrasive loss)的理解(相似度越大越相似的情况):
- OpenStack-Ironic裸金属简介
- Java同步技术 (一)
- 35、jaeger链路追踪
- matlab实现多项式的运算,Matlab 多项式运算
- Android 定制自己的launcher
- Java与Android配合开发ICQ、2018-8-13完结