【问题标题】:Error while installing npm packages npm ERR! code ELIFECYCLE安装 npm 包时出错 npm ERR!代码生命周期
【发布时间】:2020-06-22 15:20:07
【问题描述】:

不知道发生了什么,但我收到以下错误

>npx create-react-app .
>npm i <packages>
>npm install 

等等,所以上面的命令都不起作用

错误:

npm ERR! code ELIFECYCLE
npm ERR! syscall spawn C:\Program Files\git\bin\bash.exe
npm ERR! file C:\Program Files\git\bin\bash.exe
npm ERR! path C:\Program Files\git\bin\bash.exe
npm ERR! errno ENOENT
npm ERR! core-js@2.6.11 postinstall: `node -e "try{require('./postinstall')}catch(e){}"`
npm ERR! spawn C:\Program Files\git\bin\bash.exe ENOENT
npm ERR! 
npm ERR! Failed at the core-js@2.6.11 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

我发现这主要是 Windows 的问题,但我使用的是 Mac

【问题讨论】:

    标签: bash npm npm-install npm-start


    【解决方案1】:

    https://github.com/facebook/create-react-app/issues/8441 这可能会对您有所帮助。可能是因为 bash 错误!

    【讨论】:

      【解决方案2】:

      以管理员身份打开CMD,然后运行:

      npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
      

      【讨论】:

        猜你喜欢
        • 2017-12-27
        • 2020-12-23
        • 2021-07-10
        • 2018-09-03
        • 2023-01-12
        • 2019-09-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多