Laravel5.5 使用npm run dev 报错解决办法

作者:admin 发布:2018-03-04 浏览:3001次

本地环境为vagrant+virtualBox+ubuntu16.04+Laravel5.5+npm5.6+node9.6.1

npm install --no-bin-links(直接执行npm install会报错)

可能会报错

 Error: autoreconf -fiv && ./configure --disable-shared --disable-dependency-tracking --with-jpeg8  --prefix="/vagrant/www/sample/node_modules/mozjpeg/vendor" --bindir="/vagrant/www/sample/node_modules/mozjpeg/vendor" --libdir="/vagrant/www/sample/node_modules/mozjpeg/vendor" && make -j1 && make install -j1
Command failed: autoreconf -fiv
/bin/sh: 1: autoreconf: not found

解决办法:

apt-get install autoconf automake libtool

执行

npm run dev

报错

sh: 1: cross-env: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js
 --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the @ development 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!     /root/.npm/_logs/2018-03-04T02_52_14_317Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ 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!     /root/.npm/_logs/2018-03-04T02_52_14_373Z-debug.log

解决办法:修改package.json

image.png


Comments (0)