npm安装失败,并显示npm.cmd:找不到命令

时间:2019-10-03 09:48:58

标签: linux npm npm-install nvm n

我们目前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

enter image description here

1 个答案:

答案 0 :(得分:0)

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