執(zhí)行npm run dev就失敗了
vue 安裝成功,項(xiàng)目創(chuàng)建也成功了,執(zhí)行npm run dev就失敗了,失敗結(jié)果
> test1@1.0.0 dev /Users/ann/test1
> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
sh: webpack-dev-server: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! test1@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
npm ERR! spawn ENOENT
npm ERR!?
npm ERR! Failed at the test1@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! ? ? /Users/ann/.npm/_logs/2018-10-28T08_11_37_746Z-debug.log
,npm -v也顯示版本的。
有時(shí)候執(zhí)行其他命令會(huì)出現(xiàn)command not found,比如我想用brew安裝node就會(huì)出現(xiàn)-bash: brew: command not found。
我是mac電腦,請(qǐng)求高手老師幫忙,困擾好多天了,萬(wàn)分感謝
2019-06-04
將項(xiàng)目里的“node_modules”文件夾刪除,然后在cmd中cd到項(xiàng)目目錄,依次運(yùn)行命令:npm install和npm run build,最后運(yùn)行npm run dev后項(xiàng)目成功運(yùn)行。
2018-10-31
先 cd 到項(xiàng)目對(duì)應(yīng)的地址,再執(zhí)行npm run dev指令