【问题标题】:npm install fails with npm.cmd: command not foundnpm install 失败并显示 npm.cmd: command not found
【发布时间】:2019-10-03 09:48:58
【问题描述】:

我们目前使用sudo npm i 而不是npm i 来规避此问题。但是,我们的 Ubuntu 团队成员不能这样做,因为没有为 root 安装 nvm。 NVM 和 N 都有同样的问题。

geoyws-mbp:ifca-construction-react geoyws$ npm i

> ifca-construction-react@0.1.0 prepare /Users/geoyws/work/src/ifca/ifca-react/src/modules/ifca-construction-react
> npm.cmd run compile

sh: npm.cmd: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! ifca-construction-react@0.1.0 prepare: `npm.cmd run compile`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the ifca-construction-react@0.1.0 prepare script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/geoyws/.npm/_logs/2019-10-03T09_40_46_545Z-debug.log

【问题讨论】:

  • 可以在...中找到完整的运行日志 - 您应该检查日志文件并提供详细信息。

标签: linux npm npm-install nvm n


【解决方案1】:

问题是我们的一位工程师在我们的package.json 中将我们的npm 启动脚本从npm run compile 更改为npm.cmd run compile。无论是那个还是 create-react-app 都这样做了,这是非常不明智的,因为人们在同一个代码库上使用各种操作系统。

【讨论】:

    猜你喜欢
    • 2011-02-12
    • 1970-01-01
    • 2019-07-01
    • 2021-02-17
    • 2021-12-12
    • 2022-12-10
    • 2022-12-25
    • 2016-01-15
    • 2022-01-26
    相关资源
    最近更新 更多