Angular报错-Error: ENOENT: no such file or directory, scandir '/Users/echo_hx/node_modules'
生活随笔
收集整理的這篇文章主要介紹了
Angular报错-Error: ENOENT: no such file or directory, scandir '/Users/echo_hx/node_modules'
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
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也會產(chǎn)生不可預料的未知錯誤,所以也要安裝cnpm,用yarn也行。
1.重裝angular-cli
npm uninstall -g @angular/cli再清一下緩存
npm cache clean --force若清空緩存時出現(xiàn)錯誤,執(zhí)行以下命令,要么沒權(quán)限啥的,用sudo?
npm cache clear --force && npm install --no-shrinkwrap --update-binary2.設置淘寶代理,以安裝cnpm。cnpm可代替npm,命令格式相同。
npm config rm proxy npm config rm https-proxy sudo npm install cnpm -g --registry=https://registry.npm.taobao.org3.然后安裝Angular-cli
cnpm install -g @angular/cli@latest最后,ng v 查看版本
?
OK,,,完美……^?_?^
參考文章:全局安裝 Angular CLI
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎總結(jié)
以上是生活随笔為你收集整理的Angular报错-Error: ENOENT: no such file or directory, scandir '/Users/echo_hx/node_modules'的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 荣耀平板8手写笔怎么连接? 荣耀平板8连
- 下一篇: git 重新关联远程仓库地址