新手怎么解决 NPM run dev 报错的问题?
新建好项目后,我们切换到项目目录并启动本地服务:
> cd vuejs-essentia > npm run dev
结果报错:
vagrant@homestead:~/Code/vuejs-essential$ npm run dev > vuejs-essential@1.0.0 dev /home/vagrant/Code/vuejs-essential > webpack-dev-server --inline --progress --config build/webpack.dev.conf.js sh: 1: webpack-dev-server: not found npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! vuejs-essential@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 vuejs-essential@1.0.0 dev 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! /home/vagrant/.npm/_logs/2018-10-31T09_19_45_071Z-debug.log
尝试1:
rm -rf node_modules
在运行 npm install
结果报错:
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself. npm ERR! path /home/vagrant/Code/vuejs-essential/node_modules/aproba/package.json.2880592470 npm ERR! code ETXTBSY npm ERR! errno -26 npm ERR! syscall rename npm ERR! ETXTBSY: text file is busy, rename '/home/vagrant/Code/vuejs-essential/node_modules/aproba/package.json.2880592470' -> '/home/vagrant/Code/vuejs-essential/node_modules/aproba/package.json' npm ERR! A complete log of this run can be found in: npm ERR! /home/vagrant/.npm/_logs/2018-10-31T11_41_00_533Z-debug.log
尝试2:
rm -rf node_modules
在运行 yarn install --no-bin-links
vagrant@homestead:~/Code/vuejs-essential$ rm -rf node_modules/ vagrant@homestead:~/Code/vuejs-essential$ yarn install --no-bin-links yarn install v1.7.0 [1/5] Validating package.json... [2/5] Resolving packages... [3/5] Fetching packages... info fsevents@1.2.4: The platform "linux" is incompatible with this module. info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation. [4/5] Linking dependencies... [5/5] Building fresh packages... Done in 96.25s.
没有报错
在执行 npm run dev 还是报上面那个错,求解!