日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

Angular报错-Error: ENOENT: no such file or directory, scandir '/Users/echo_hx/node_modules'

發(fā)布時間:2023/12/31 67 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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)生不可預(yù)料的未知錯誤,所以也要安裝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-binary

2.設(shè)置淘寶代理,以安裝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

創(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)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。