vue 安装成功,项目创建也成功了,执行npm run dev就失败了,失败结果
> 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也显示版本的。
有时候执行其他命令会出现command not found,比如我想用brew安装node就会出现-bash: brew: command not found。
我是mac电脑,请求高手老师帮忙,困扰好多天了,万分感谢
将项目里的“node_modules”文件夹删除,然后在cmd中cd到项目目录,依次运行命令:npm install和npm run build,最后运行npm run dev后项目成功运行。
先 cd 到项目对应的地址,再执行npm run dev指令