Reputation: 34
Whenever I try to run Laravel Mix npm run dev
with app.js compilation included on my local Laravel 5.5 project, I get following error:
95% emittingError: EIO: i/o error, close
npm ERR! code ELIFECYCLE
npm ERR! errno 1
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! Exit status 1
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! /home/vagrant/.npm/_logs/2018-01-02T17_38_00_013Z-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! /home/vagrant/.npm/_logs/2018-01-02T17_38_00_037Z-debug.log
and here is content of log file:
0 info it worked if it ends with ok
1 verbose cli [ '/home/vagrant/.nvm/versions/node/v9.3.0/bin/node',
1 verbose cli '/home/vagrant/.nvm/versions/node/v9.3.0/bin/npm',
1 verbose cli 'run',
1 verbose cli 'development' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predevelopment', 'development', 'postdevelopment' ]
5 info lifecycle aqualis2@~predevelopment: aqualis2@
6 info lifecycle aqualis2@~development: aqualis2@
7 verbose lifecycle aqualis2@~development: unsafe-perm in lifecycle true
8 verbose lifecycle aqualis2@~development: PATH: /home/vagrant/.nvm/versions/node/v9.3.0/lib/node_modules/npm/bin/node-gyp-bin:/home/vagrant/aqualis2/node_modules/.bin:/home/vagrant/.nvm/versions/node/v9.3.0/lib/node_modules/npm/bin/node-gyp-bin:/home/vagrant/aqualis2/node_modules/.bin:/home/vagrant/.nvm/versions/node/v9.3.0/bin:/home/vagrant/.composer/vendor/bin:/home/vagrant/bin:/home/vagrant/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle aqualis2@~development: CWD: /home/vagrant/aqualis2
10 silly lifecycle aqualis2@~development: Args: [ '-c',
10 silly lifecycle 'node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js' ]
11 silly lifecycle aqualis2@~development: Returned: code: 1 signal: null
12 info lifecycle aqualis2@~development: Failed to exec development script
13 verbose stack Error: aqualis2@ development: `node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/home/vagrant/.nvm/versions/node/v9.3.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
13 verbose stack at EventEmitter.emit (events.js:159:13)
13 verbose stack at ChildProcess.<anonymous> (/home/vagrant/.nvm/versions/node/v9.3.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:159:13)
13 verbose stack at maybeClose (internal/child_process.js:943:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid aqualis2@
15 verbose cwd /home/vagrant/aqualis2
16 verbose Linux 4.4.0-51-generic
17 verbose argv "/home/vagrant/.nvm/versions/node/v9.3.0/bin/node" "/home/vagrant/.nvm/versions/node/v9.3.0/bin/npm" "run" "development"
18 verbose node v9.3.0
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error aqualis2@ development: `node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
22 error Exit status 1
23 error Failed at the aqualis2@ development script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Here is my webpack.min.js file:
let mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
// on configure webpack
mix.webpackConfig({
module: {
loaders: [
{
test: require.resolve('pace-progress'),
loader: 'imports?define=>false',
},
],
},
node: {
fs: 'empty',
},
resolve: {
alias: {
'handlebars': 'handlebars/dist/handlebars.js',
},
},
});
// on copie les images non ciblées dans les scripts ou feuilles de style
mix.copy('resources/assets/*', 'public');
mix.copy('resources/assets/images/*', 'public/images');
// on compile/minifie les scripts et on isole les vendors
mix.js('resources/assets/js/app.js', 'public/js')
.extract([
'lodash',
'jquery',
'admin-lte',
'lodash',
'jquery',
'admin-lte',
'pace-progress',
'jquery-slimscroll',
'fastclick',
'bootstrap-datepicker',
'bootstrap-datepicker/dist/locales/bootstrap-datepicker.fr.min',
'bootstrap-timepicker',
'bootstrap-colorpicker',
'icheck',
'select2',
'daterangepicker',
'handlebars',
'jspdf',
'html2pdf.js',
'datatables.net',
'datatables.net-bs',
'datatables.net-responsive',
'datatables.net-responsive-bs',
'bootbox',
'moment',
'moment/locale/fr',
'highcharts/highstock',
'highcharts/modules/exporting',
'highcharts/modules/export-data',
'highcharts/modules/no-data-to-display',
'pusher-js',
'laravel-echo',
'vue'
]);
// on compile/minifie la feuille de style pour bootstrap
mix.sass('resources/assets/sass/bootstrap.scss', 'public/css/bs.css');
// on compile/minifie la feuille de style pour le thème admin-lte
mix.less('resources/assets/less/adminlte.less', 'public/css')
.options({
processCssUrls: false,
});
// on compile/minifie notre feuille de style perso
mix.sass('resources/assets/sass/app.scss', 'public/css');
// on active les sourcemaps
mix.sourceMaps();
// on versionne nos images, scripts et feuilles de style
mix.version();
if (!mix.inProduction()) {
mix.browserSync(process.env.APP_URL);
}
My app.js content:
require("./bootstrap");
require("./common");
I know this is due to JS because if I comment out the .extract([...])
and all bootstrap.js content it compiles, but if I have any reference of a library it breaks (for example it breaks if content of bootstrap.js is only window._ = require('lodash');
This is really weird because when I use a fresh new Laravel install, it first works but after any change into webpack.config.js it breaks and rolling it back doesn't help: once it's broken I can't have it working anymore.
I use Homestead on a Windows 10 machine and node and npm versions are (I tried using nvm to solve the problem but unfortunately it doesn't work):
vagrant@homestead:~/laravel_test$ node -v
v9.3.0
vagrant@homestead:~/laravel_test$ npm -v
5.6.0
Any clue on what's going on?
Upvotes: 1
Views: 2751
Reputation: 366
On Windows with vagrant the only solution that works for me is to manually end "NFS server for windows" process from Task Manager and do vagrant reload
Upvotes: 2
Reputation: 34
For anyone having same problem, after 2 weeks investigation, I finally found the reason: NFS enabled on vagrant Homestead!!! I simply remove the option and it now works.
Upvotes: 0