I installed a fresh laravel 5.4 application. I followed the documentation on how to set up laravel mix. However, when I run npm run dev i get the following error:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'run', 'dev' ]
2 info using npm#3.8.6
3 info using node#v5.12.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle #~predev: #
6 silly lifecycle #~predev: no script for predev, continuing
7 info lifecycle #~dev: #
8 verbose lifecycle #~dev: unsafe-perm in lifecycle true
9 verbose lifecycle #~dev: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/home/vagrant/websites/ezskillz/node_modules/.bin:/usr/bin:/home/vagrant/.composer/vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
10 verbose lifecycle #~dev: CWD: /home/vagrant/websites/ezskillz
11 silly lifecycle #~dev: Args: [ '-c',
11 silly lifecycle 'node node_modules/cross-env/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' ]
12 silly lifecycle #~dev: Returned: code: 1 signal: null
13 info lifecycle #~dev: Failed to exec dev script
14 verbose stack Error: # dev: `node node_modules/cross-env/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`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:239:16)
14 verbose stack at emitTwo (events.js:100:13)
14 verbose stack at EventEmitter.emit (events.js:185:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:24:14)
14 verbose stack at emitTwo (events.js:100:13)
14 verbose stack at ChildProcess.emit (events.js:185:7)
14 verbose stack at maybeClose (internal/child_process.js:850:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid #
16 verbose cwd /home/vagrant/websites/ezskillz
17 error Linux 4.4.0-22-generic
18 error argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "dev"
19 error node v5.12.0
20 error npm v3.8.6
21 error code ELIFECYCLE
22 error # dev: `node node_modules/cross-env/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 # dev script 'node node_modules/cross-env/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'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error node node_modules/cross-env/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
23 error You can get information on how to open an issue for this project with:
23 error npm bugs
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
do you have any idea what's going on?
Thank you
I figured it out. Thanks to Andy Holmes. I had to update my nodejs in homestead running the following commands
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
and then I run the following command to rebuild node-sass
npm rebuild node-sass
Thanks
I removed the whole node_modules folder and tried installing packages with yarn instead of npm.
Delete the node_modules folder
Re-install packages using yarn i.e run yarn instead of npm install.
I hope this helps someone.
You have node and npm if you look at line 2 and 3 you can see
2 info using npm#3.8.6
3 info using node#v5.12.0
And at line 23 In the mid:
23 error If you do, this is most likely a problem with the package,
23 error not with npm itself.
i don't know why it is the case, whether it was a particular version that had a bug which has since been fixed, but to get my fresh laravel 5.4 install working at the time I had to change the paths in package.json from:
node_modules/cross-env/bin/cross-env.js
to
node_modules/cross-env/dist/bin/cross-env.js
note the addition of "dist"
Edit:
Actually notice on a newer fresh install the entire
node node_modules/cross-env/bin/cross-env.js
line is replaced simply with
cross-env
So for example:
"scripts": {
"dev": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --watch-poll --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
Related
this is my package.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"serve": "node --version",
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node your-script.js"
},
"devDependencies": {
"axios": "^0.19",
"core-js": "^2.6.5",
"cross-env": "^7.0.2",
"laravel-mix": "^0.10.0np",
"lodash": "^4.17.19",
"resolve-url-loader": "^3.1.0",
"webpack": "^2.1.0-beta.22"
}
}
and the error is
$ npm run dev
# dev C:\xampp\htdocs\laspp
npm run development
# development C:\xampp\htdocs\laspp
cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
95% emitting
ERROR Failed to compile with 3 errors 5:48:21 PM
These dependencies were not found:
* jquery in ./resources/assets/js/bootstrap.js
* bootstrap-sass in ./resources/assets/js/bootstrap.js
* vue in ./resources/assets/js/bootstrap.js
To install them, you can run: npm install --save jquery bootstrap-sass vue
Asset Size Chunks Chunk Names
/js/app.js 603 kB 0 [emitted] [big] /js/app
mix-manifest.json 32 bytes [emitted]
npm ERR! code ELIFECYCLE
npm ERR! errno 2
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 2
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! C:\Users\Natty\AppData\Roaming\npm-cache\_logs\2020-10-13T00_48_22_038Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! # dev: `npm run development`
npm ERR! Exit status 2
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! C:\Users\Natty\AppData\Roaming\npm-cache\_logs\2020-10-13T00_48_22_141Z-debug.log
finally, I tried this
rm -rf node-modules
rm packageson-lock.json
npm cache clean --force
npm install
but it does not work
Looking your error and your package.json, this error tell you this :
To install them, you can run: npm install --save jquery bootstrap-sass vue
Can you do this and restart your npm run development ?
In laravel 5.8 app I suffer error:
sh: 1: cross-env: Permission denied
on command
npm run watch-poll
That happed after I installed ubuntu 18.04 and composer/nodejs/nmp as:
$ uname -a
Linux serge 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ composer --version
Composer 1.6.3 2018-01-31 16:28:17
$ nodejs --version
v10.16.1
$ npm --version
6.9.0
I mannully removed directory node_modules and run :
$ npm install
> node-sass#4.12.0 install /mnt/_work_sdb8/wwwroot/lar/votes/node_modules/node-sass
> node scripts/install.js
Cached binary found at /home/serge/.npm/node-sass/4.12.0/linux-x64-64_binding.node
> puppeteer#1.19.0 install /mnt/_work_sdb8/wwwroot/lar/votes/node_modules/puppeteer
> node install.js
Downloading Chromium r674921 - 112.6 Mb [====================] 100% 0.0s
Chromium downloaded to /mnt/_work_sdb8/wwwroot/lar/votes/node_modules/puppeteer/.local-chromium/linux-674921
> core-js-pure#3.1.4 postinstall /mnt/_work_sdb8/wwwroot/lar/votes/node_modules/core-js-pure
> node scripts/postinstall || echo "ignore"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
> node-sass#4.12.0 postinstall /mnt/_work_sdb8/wwwroot/lar/votes/node_modules/node-sass
> node scripts/build.js
Binary found at /mnt/_work_sdb8/wwwroot/lar/votes/node_modules/node-sass/vendor/linux-x64-64/binding.node
Testing binary
Binary is fine
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 1192 packages from 569 contributors and audited 15586 packages in 32.601s
found 0 vulnerabilities
serge#serge:/mnt/_work_sdb8/wwwroot/lar/votes$ npm run watch-poll
> # watch-poll /mnt/_work_sdb8/wwwroot/lar/votes
> npm run watch -- --watch-poll
> # watch /mnt/_work_sdb8/wwwroot/lar/votes
> npm run development -- --watch "--watch-poll"
> # development /mnt/_work_sdb8/wwwroot/lar/votes
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch" "--watch-poll"
sh: 1: cross-env: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
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 "--watch" "--watch-poll"`
npm ERR! Exit status 126
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/serge/.npm/_logs/2019-08-06T14_56_10_670Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! # watch: `npm run development -- --watch "--watch-poll"`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the # watch 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/serge/.npm/_logs/2019-08-06T14_56_10_688Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! # watch-poll: `npm run watch -- --watch-poll`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the # watch-poll 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/serge/.npm/_logs/2019-08-06T14_56_10_709Z-debug.log
Mentioned files :
2019-08-06T14_56_10_670Z-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli '/usr/bin/npm',
1 verbose cli 'run',
1 verbose cli 'development',
1 verbose cli '--',
1 verbose cli '--watch',
1 verbose cli '--watch-poll' ]
2 info using npm#6.9.0
3 info using node#v10.16.1
4 verbose run-script [ 'predevelopment', 'development', 'postdevelopment' ]
5 info lifecycle #~predevelopment: #
6 info lifecycle #~development: #
7 verbose lifecycle #~development: unsafe-perm in lifecycle true
8 verbose lifecycle #~development: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/mnt/_work_sdb8/wwwroot/lar/votes/node_modules/.bin:/usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/mnt/_work_sdb8/wwwroot/lar/votes/node_modules/.bin:/usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/mnt/_work_sdb8/wwwroot/lar/votes/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle #~development: CWD: /mnt/_work_sdb8/wwwroot/lar/votes
10 silly lifecycle #~development: Args: [ '-c',
10 silly lifecycle 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch" "--watch-poll"' ]
11 silly lifecycle #~development: Returned: code: 126 signal: null
12 info lifecycle #~development: Failed to exec development script
13 verbose stack Error: # development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch" "--watch-poll"`
13 verbose stack Exit status 126
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid #
15 verbose cwd /mnt/_work_sdb8/wwwroot/lar/votes
16 verbose Linux 4.15.0-20-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "development" "--" "--watch" "--watch-poll"
18 verbose node v10.16.1
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 126
22 error # development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch" "--watch-poll"`
22 error Exit status 126
23 error Failed at the # development script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]
2019-08-06T14_56_10_688Z-debug.log :
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli '/usr/bin/npm',
1 verbose cli 'run',
1 verbose cli 'watch',
1 verbose cli '--',
1 verbose cli '--watch-poll' ]
2 info using npm#6.9.0
3 info using node#v10.16.1
4 verbose run-script [ 'prewatch', 'watch', 'postwatch' ]
5 info lifecycle #~prewatch: #
6 info lifecycle #~watch: #
7 verbose lifecycle #~watch: unsafe-perm in lifecycle true
8 verbose lifecycle #~watch: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/mnt/_work_sdb8/wwwroot/lar/votes/node_modules/.bin:/usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/mnt/_work_sdb8/wwwroot/lar/votes/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle #~watch: CWD: /mnt/_work_sdb8/wwwroot/lar/votes
10 silly lifecycle #~watch: Args: [ '-c', 'npm run development -- --watch "--watch-poll"' ]
11 silly lifecycle #~watch: Returned: code: 126 signal: null
12 info lifecycle #~watch: Failed to exec watch script
13 verbose stack Error: # watch: `npm run development -- --watch "--watch-poll"`
13 verbose stack Exit status 126
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid #
15 verbose cwd /mnt/_work_sdb8/wwwroot/lar/votes
16 verbose Linux 4.15.0-20-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "watch" "--" "--watch-poll"
18 verbose node v10.16.1
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 126
22 error # watch: `npm run development -- --watch "--watch-poll"`
22 error Exit status 126
23 error Failed at the # watch script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]
2019-08-06T14_56_10_709Z-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'watch-poll' ]
2 info using npm#6.9.0
3 info using node#v10.16.1
4 verbose run-script [ 'prewatch-poll', 'watch-poll', 'postwatch-poll' ]
5 info lifecycle #~prewatch-poll: #
6 info lifecycle #~watch-poll: #
7 verbose lifecycle #~watch-poll: unsafe-perm in lifecycle true
8 verbose lifecycle #~watch-poll: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/mnt/_work_sdb8/wwwroot/lar/votes/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle #~watch-poll: CWD: /mnt/_work_sdb8/wwwroot/lar/votes
10 silly lifecycle #~watch-poll: Args: [ '-c', 'npm run watch -- --watch-poll' ]
11 silly lifecycle #~watch-poll: Returned: code: 126 signal: null
12 info lifecycle #~watch-poll: Failed to exec watch-poll script
13 verbose stack Error: # watch-poll: `npm run watch -- --watch-poll`
13 verbose stack Exit status 126
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid #
15 verbose cwd /mnt/_work_sdb8/wwwroot/lar/votes
16 verbose Linux 4.15.0-20-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "watch-poll"
18 verbose node v10.16.1
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 126
22 error # watch-poll: `npm run watch -- --watch-poll`
22 error Exit status 126
23 error Failed at the # watch-poll script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]
package.json:
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.19.0",
"bootstrap": "^4.3.1",
"cross-env": "^5.1",
"laravel-mix": "^4.0.16",
"lodash": "^4.17.11",
"popper.js": "^1.14.6",
"vue": "^2.5.7"
},
"dependencies": {
"bootstrap-colorpicker": "^3.1.2",
"datatables.net-bs": "^1.10.19",
"font-awesome": "^4.7.0",
"jquery": "^3.4.1",
"jquery-confirm": "^3.3.2",
"laravel-echo": "^1.5.2",
"mustache": "^2.3.0",
"node-sass": "^4.12.0",
"puppeteer": "^1.19.0",
"resolve-url-loader": "^2.3.1",
"sass-loader": "^7.1.0",
"vue-template-compiler": "^2.6.10"
}
}
Googling for decision I found sh: 1: cross-env: Permission denied on laravel mix with decision :
Ok I figure out the problem, the storage where the project is saved is
auto-mounted and it have no execution permission.
easily in /etc/fstab file i added exec in the mount option, like this:
auto,user,exec,utf8,uid=1000,gid=1000,rw 0 0
so I modified this partition in /etc/fstab :
UUID=72209A012099CD0B /mnt/Media_sda8 ntfs-3g exec,uid=1000,gid=1000,dmask=022,fmask=133 rw 0 0
and restarting the OS. I have the same problem.
Has line above correct syntax?
On prior kubuntu 18.4 installation it worked ok.
How to fix it?
First following this command
npm rebuild
then this
npm run watch-poll
You need to run the following commands.
rm -rf node_modules
rm package-lock.json
npm cache clear --force
npm install
Laravel version 5.5
Laravel Mix Version 4.0.16
Node Version v10.16.0
NPM Version 6.9.0
OS Centos 7
Description
After I upgrade laravel-mix from 1* to 4.0.16 by using npm update command, npm run production doesn't work but npm run watch command works correctly.
package.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.19.0",
"bootstrap-sass": "^3.4.1",
"cross-env": "^5.0.1",
"jquery": "^3.4.1",
"laravel-mix": "^4.0.16",
"lodash": "^4.17.4",
"vue": "^2.6.10"
},
"dependencies": {
"vue-js-modal": "^1.3.31",
"vue-router": "^3.0.6",
"vue-slider-component": "^3.0.32",
"vue-template-compiler": "^2.6.10"
}
}
npm run production error
[jezygroup#server jezyGroup]$ npm run production
> # production /home/jezygroup/jezyGroup
> cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
10% building 0/1 modules 1 active ...p/resources/assets/js/AdminPanel/app.j 10% building 1/1 modules 0 activenpm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # production: `cross-env NODE_ENV=production 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 # production 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/jezygroup/.npm/_logs/2019-06-06T11_39_30_311Z-debug.log
log file
[jezygroup#server jezyGroup]$ cat /home/jezygroup/.npm/_logs/2019-06-06T11_39_30_311Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/home/jezygroup/.nvm/versions/node/v10.16.0/bin/node',
1 verbose cli '/home/jezygroup/.nvm/versions/node/v10.16.0/bin/npm',
1 verbose cli 'run',
1 verbose cli 'production' ]
2 info using npm#6.9.0
3 info using node#v10.16.0
4 verbose run-script [ 'preproduction', 'production', 'postproduction' ]
5 info lifecycle #~preproduction: #
6 info lifecycle #~production: #
7 verbose lifecycle #~production: unsafe-perm in lifecycle true
8 verbose lifecycle #~production: PATH: /home/jezygroup/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/jezygroup/jezyGroup/node_modules/.bin:/home/jezygroup/.nvm/versions/node/v10.16.0/bin:/usr/local/cpanel/3rdparty/lib/path-bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/cpanel/composer/bin:/home/jezygroup/.local/bin:/home/jezygroup/bin
9 verbose lifecycle #~production: CWD: /home/jezygroup/jezyGroup
10 silly lifecycle #~production: Args: [ '-c',
10 silly lifecycle 'cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js' ]
11 silly lifecycle #~production: Returned: code: 1 signal: null
12 info lifecycle #~production: Failed to exec production script
13 verbose stack Error: # production: `cross-env NODE_ENV=production 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/jezygroup/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (/home/jezygroup/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid #
15 verbose cwd /home/jezygroup/jezyGroup
16 verbose Linux 3.10.0-962.3.2.lve1.5.24.7.el7.x86_64
17 verbose argv "/home/jezygroup/.nvm/versions/node/v10.16.0/bin/node" "/home/jezygroup/.nvm/versions/node/v10.16.0/bin/npm" "run" "production"
18 verbose node v10.16.0
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error # production: `cross-env NODE_ENV=production 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 # production script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
webpack.mix.js
let mix = require('laravel-mix');
// panel assets
mix.scripts([
'resources/assets/vendor/js/jquery-3.2.1.min.js',
'resources/assets/vendor/admin-panel/js/bootstrap.min.js',
'resources/assets/vendor/admin-panel/js/material.min.js',
'resources/assets/vendor/admin-panel/js/perfect-scrollbar.jquery.min.js',
'resources/assets/vendor/admin-panel/js/arrive.min.js',
'resources/assets/vendor/admin-panel/js/jquery.validate.min.js',
'resources/assets/vendor/admin-panel/js/bootstrap-notify.js',
'resources/assets/vendor/admin-panel/js/jquery.select-bootstrap.js',
'resources/assets/vendor/admin-panel/js/material-dashboard.js',
], 'public/js/AdminPanel.js');
mix.js('resources/assets/js/AdminPanel/app.js', 'public/js/app.js').version();
mix.styles([
'resources/assets/vendor/admin-panel/css/bootstrap.min.css',
'resources/assets/vendor/admin-panel/css//bootstrap-rtl.min.css',
'resources/assets/vendor/admin-panel/css/material-dashboard.css',
'resources/assets/vendor/admin-panel/css/mokas.css',
'resources/assets/vendor/admin-panel/css/custom.css',
], 'public/css/AdminPanel.css');
//================================================================
//=========================FRONTEND MIX ==========================
//================================================================
//===Main
mix.styles([
'resources/assets/vendor/frontend/css/bootstrap-rtl.css',
'resources/assets/vendor/frontend/css/elegant-icons.css',
'resources/assets/vendor/frontend/css/animate.css',
'resources/assets/vendor/frontend/css/slick.css',
'resources/assets/vendor/frontend/css/magnific-popup.css',
'resources/assets/vendor/frontend/css/fontiran.css',
'resources/assets/vendor/frontend/css/FontAwesome.min.css',
'resources/assets/vendor/frontend/css/toastr.min.css',
'resources/assets/vendor/frontend/css/style.css',
'resources/assets/vendor/frontend/css/responsive.css',
],'public/css/front.min.css');
mix.scripts([
'resources/assets/vendor/frontend/js/jquery-2.1.1.min.js',
'resources/assets/vendor/frontend/js/bootstrap.min.js',
'resources/assets/vendor/frontend/js/jquery.easing.js',
'resources/assets/vendor/frontend/js/wow.min.js',
'resources/assets/vendor/frontend/js/toastr.min.js',
'resources/assets/vendor/frontend/js/magnific-popup.min.js',
'resources/assets/vendor/frontend/js/jquery.scrollUp.min.js',
'resources/assets/vendor/frontend/js/slick.min.js',
'resources/assets/vendor/frontend/js/main.js',
],'public/js/front.min.js').version();
// Request wizard
mix.js('resources/assets/js/RequestWizard/app.js', 'public/js/wizard-request.min.js').version();
Update your package.json with the latest, specifically the "scripts" part.
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"dependencies": {
"axios": "^0.19",
"bootstrap": "^4.1.0",
"cross-env": "^5.1",
"jquery": "^3.4.1",
"laravel-mix": "^4.0.16",
"lodash": "^4.17.5",
"popper.js": "^1.12",
"resolve-url-loader": "^2.3.1",
"sass": "^1.15.2",
"sass-loader": "^7.1.0",
"vue": "^2.6.10",
"vue-js-modal": "^1.3.31",
"vue-router": "^3.0.6",
"vue-slider-component": "^3.0.32",
"vue-template-compiler": "^2.6.10"
}
}
I'm trying to run "npm run dev" with my Laravel project. But this keeps ending up in an error "ERR! code ELIEFECYCLE"
I've basically tried a lot of different solutions... Tried everything in this one: laravel npm run dev ERR! code ELIFECYCLE Failed at the # development script
and even followed the link in that post with no luck. I've been pulling my hair out trying to solve this...
Deleted nodes-modules A LOT. And reinstalls of NPM. Force cleared the cache. Different webpack versions and so on.. But if i try different versions I get an error saying it doesn't match API scheme version.
So now. I'm looking here for some answers/help.
This is from my command line after I ran "npm run dev"
#
# Fatal error in , line 0
# Check failed: U_SUCCESS(status).
#
#
#
#FailureMessage Object: 0000005E5DCFDB70npm ERR! code ELIFECYCLE
npm ERR! errno 3221225477
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 3221225477
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! C:\Users\stito\AppData\Roaming\npm-cache\_logs\2019-04-28T21_34_16_881Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 3221225477
npm ERR! # dev: `npm run development`
npm ERR! Exit status 3221225477
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! C:\Users\stito\AppData\Roaming\npm-cache\_logs\2019-04-28T21_34_16_900Z-debug.log
Log file
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'dev'
1 verbose cli ]
2 info using npm#6.9.0
3 info using node#v12.0.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle #~predev: #
6 info lifecycle #~dev: #
7 verbose lifecycle #~dev: unsafe-perm in lifecycle true
8 verbose lifecycle #~dev: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\stito\Documents\Toftes IT Service\dev\toftesitservice\node_modules\.bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet\;C:\Program Files (x86)\Bitvise SSH Client;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\NVIDIA Corporation\NVIDIA NGX;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\Common Files\Autodesk Shared\;C:\Program Files (x86)\Autodesk\Backburner\;C:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\Program Files\nodejs\;C:\Users\stito\AppData\Local\Microsoft\WindowsApps;C:\Users\stito\AppData\Roaming\Composer\vendor\bin;C:\Users\stito\AppData\Roaming\npm
9 verbose lifecycle #~dev: CWD: C:\Users\stito\Documents\Toftes IT Service\dev\toftesitservice
10 silly lifecycle #~dev: Args: [ '/d /s /c', 'npm run development' ]
11 silly lifecycle #~dev: Returned: code: 3221225477 signal: null
12 info lifecycle #~dev: Failed to exec dev script
13 verbose stack Error: # dev: `npm run development`
13 verbose stack Exit status 3221225477
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:196:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:196:13)
13 verbose stack at maybeClose (internal/child_process.js:1000:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:267:5)
14 verbose pkgid #
15 verbose cwd C:\Users\stito\Documents\Toftes IT Service\dev\toftesitservice
16 verbose Windows_NT 10.0.17763
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v12.0.0
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 3221225477
22 error # dev: `npm run development`
22 error Exit status 3221225477
23 error Failed at the # dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 3221225477, true ]
package.json file
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.18",
"bootstrap": "^4.0.0",
"cross-env": "^5.1",
"jquery": "^3.2",
"laravel-mix": "^4.0.7",
"lodash": "^4.17.5",
"popper.js": "^1.12",
"resolve-url-loader": "^2.3.1",
"sass": "^1.15.2",
"sass-loader": "^7.1.0",
"vue": "^2.5.17",
"vue-template-compiler": "^2.6.10"
}
}
This is now solved.. I solved it by downgrading Node.js to 10.15.3 from 12.1.0
This is now solved.. I solved it by downgrading Node.js to 10.15.3 from 12.1.0
And started from scratch with NPM in my Laravel project.
First: check your node.js version
Write:
$ node -v
Make sure that your node.js version is up to date to the latest
If your version is cool then do the following:
Step 1: $ npm cache clean --force
Step 2: Delete node_modules by
$ rm -rf node_modules ,
$ rmdir /S /Q node_modules (in windows)
or delete it manually by going into the directory and right-click > delete / move to trash.
If you are not updating your packages you can delete the package-lock.json file too.
$ rm ./package-lock.json
or delete it manually by going into the file and right-click > delete / move to trash.
Step 3: npm install
To start again, $ npm start
step 4: npm run dev
This worked for me. Hopes it works for you too.
Very new to Laravel. Attempting to Larvel 5.4 mix. After running npm install and npm run dev I get the following error in npm-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'dev' ]
2 info using npm#2.15.9
3 info using node#v4.5.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info predev #
6 info dev #
7 verbose unsafe-perm in lifecycle true
8 info # Failed to exec dev script
9 verbose stack Error: # dev: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
9 verbose stack Exit status 1
9 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:217:16)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at EventEmitter.emit (events.js:172:7)
9 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at ChildProcess.emit (events.js:172:7)
9 verbose stack at maybeClose (internal/child_process.js:829:16)
9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid #
11 verbose cwd /Users/jluser/htdocs/laravel/project
12 error Darwin 16.4.0
13 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
14 error node v4.5.0
15 error npm v2.15.9
16 error code ELIFECYCLE
17 error # dev: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
17 error Exit status 1
18 error Failed at the # dev script 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
18 error This is most likely a problem with the package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
18 error You can get information on how to open an issue for this project with:
18 error npm bugs
18 error Or if that isn't available, you can get their info via:
18 error
18 error npm owner ls
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
And the following error inline:
> # dev /Users/jluser/htdocs/laravel/project
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn node_modules/webpack/bin/webpack.js ENOENT
at exports._errnoException (util.js:907:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at nextTickCallbackWith2Args (node.js:442:9)
at process._tickCallback (node.js:356:17)
at Function.Module.runMain (module.js:443:11)
at startup (node.js:139:18)
at node.js:974:3
npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
npm ERR! node v4.5.0
npm ERR! npm v2.15.9
npm ERR! code ELIFECYCLE
npm ERR! # dev: `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 # dev script '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! This is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! 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! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/jluser/htdocs/laravel/project/npm-debug.log
I installed webpage globally. This is brand new installation of Laravel, no modifications to webpack.mix.js or any other front-end files.
Upgraded Node.js to latest stable version; resolved issue.