Laravel - npm run watch does not work on Lara 7, Node: v10.15.0 and NPM: v6.5.0 - laravel

I have an issue with Laravel and Vue. When I try to compile everything with npm run watch I get these (it suddenly stopped working):
Additional dependencies must be installed. This will only take a moment.
Running: yarn add vue-template-compiler --dev --production=false
/bin/sh: yarn: command not found
/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/webpack-cli/bin/cli.js:244
throw err;
^
Error: Command failed: yarn add vue-template-compiler --dev --production=false
/bin/sh: yarn: command not found
at checkExecSyncError (child_process.js:616:11)
at Object.execSync (child_process.js:653:13)
at Dependencies.execute (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/Dependencies.js:52:22)
at dependencies.reject.tap.dependencies (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/Dependencies.js:30:22)
at Array.value (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/helpers.js:24:13)
at Dependencies.install (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/Dependencies.js:29:14)
at Function.dependencies (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/Assert.js:77:40)
at concat.filter.tap.dependencies (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/components/ComponentFactory.js:130:24)
at Array.value (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/helpers.js:24:13)
at ComponentFactory.installDependencies (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/components/ComponentFactory.js:129:14)
at Mix.listen (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/components/ComponentFactory.js:54:44)
at events.(anonymous function).forEach.handler (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/Dispatcher.js:34:47)
at Array.forEach (<anonymous>)
at Dispatcher.fire (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/Dispatcher.js:34:28)
at Mix.dispatch (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/Mix.js:119:25)
at Object.<anonymous> (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/setup/webpack.config.js:19:5)
at Module._compile (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at WEBPACK_OPTIONS (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/webpack-cli/bin/convert-argv.js:133:13)
at requireConfig (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/webpack-cli/bin/convert-argv.js:135:6)
at /Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/webpack-cli/bin/convert-argv.js:142:17
at Array.forEach (<anonymous>)
at module.exports (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/webpack-cli/bin/convert-argv.js:140:15)
at yargs.parse (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/webpack-cli/bin/cli.js:241:39)
at Object.parse (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/yargs/yargs.js:567:18)
at /Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/webpack-cli/bin/cli.js:219:8
at Object.<anonymous> (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/webpack-cli/bin/cli.js:538:3)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
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 "--watch"`
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! /Users/kosingas/.npm/_logs/2018-12-31T13_48_22_168Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # watch: `npm run development -- --watch`
npm ERR! Exit status 1
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! /Users/kosingas/.npm/_logs/2018-12-31T13_48_22_209Z-debug.log
Borivojes-MacBook-Pro:lvue kosingas$
I am not sure what to do. Have been googling for quote some time, downgraded Node from 11 to stable LTS version 10 and nothing.
Click here to see the screenshot of the errors that I'm getting
This is what I see when I open the error log file:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'watch' ]
2 info using npm#6.5.0
3 info using node#v10.15.0
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/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Applications/MAMP_2018-03-15_05-39$
9 verbose lifecycle #~watch: CWD: /Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue
10 silly lifecycle #~watch: Args: [ '-c', 'npm run development -- --watch' ]
11 silly lifecycle #~watch: Returned: code: 1 signal: null
12 info lifecycle #~watch: Failed to exec watch script
13 verbose stack Error: # watch: `npm run development -- --watch`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:962:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid #
15 verbose cwd /Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue
16 verbose Darwin 18.0.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "watch"
18 verbose node v10.15.0

'vue-template-compiler' is missing on your packag.json, do :
rm -R node_modules
npm install
npm install -g yarnpkg
npm install --save vue-template-compiler
npm run dev

Related

Error sh: 1: cross-env: Permission denied on new Kubuntu 18 os

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

Npm run watch doesn't work with laravel : sh: cross-env: command not found

I want to execute "npm run watch" in my laravel project but it doesn't work.
There is the error message
# watch /Applications/MAMP/htdocs/test-tech/laravel5
npm run development -- --watch
# development /Applications/MAMP/htdocs/test-tech/laravel5
cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"
sh: cross-env: command 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 "--watch"
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 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/xxx/.npm/_logs/2019-03-29T11_19_55_390Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # watch: npm run development -- --watch
npm ERR! Exit status 1
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 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/xxx/.npm/_logs/2019-03-29T11_19_55_422Z-debug.log
And the debug file
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'watch' ]
2 info using npm#5.6.0
3 info using node#v8.11.3
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/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Applications/MAMP/htdocs/test-tech/laravel5/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle #~watch: CWD: /Applications/MAMP/htdocs/test-tech/laravel5
10 silly lifecycle #~watch: Args: [ '-c', 'npm run development -- --watch' ]
11 silly lifecycle #~watch: Returned: code: 1 signal: null
12 info lifecycle #~watch: Failed to exec watch script
13 verbose stack Error: # watch: `npm run development -- --watch`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid #
15 verbose cwd /Applications/MAMP/htdocs/test-tech/laravel5
16 verbose Darwin 18.2.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "watch"
18 verbose node v8.11.3
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error # watch: `npm run development -- --watch`
22 error Exit status 1
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 [ 1, true ]
I googled it and tried some solutions but it still doesn't work.
How to resolve it ?
Thanks
The problem is that you are missing cross-env, you can run
npm install -g cross-env to install it globally, or npm install cross-env to install it locally in the current project.

npm won't run dev in laravel

I am trying to get my project to work on fresh debian install. npm install works fine, but then npm run dev gives me this:
15% building modules 45/46 modules 1 active .../www/html/pms/resources/sass/app.scssnpm 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! /root/.npm/_logs/2018-12-13T14_03_05_708Z-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-12-13T14_03_05_720Z-debug.log
and the log that this is pointing to looks like this:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'dev' ]
2 info using npm#5.8.0
3 info using node#v8.11.2
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: /usr/share/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/www/html/pms/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9 verbose lifecycle #~dev: CWD: /var/www/html/pms
10 silly lifecycle #~dev: Args: [ '-c', 'npm run development' ]
11 silly lifecycle #~dev: Returned: code: 1 signal: null
12 info lifecycle #~dev: Failed to exec dev script
13 verbose stack Error: # dev: `npm run development`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/share/npm/node_modules/npm-lifecycle/index.js:283:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (/usr/share/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid #
15 verbose cwd /var/www/html/pms
16 verbose Linux 4.18.0-3-amd64
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
18 verbose node v8.11.2
19 verbose npm v5.8.0
20 error code ELIFECYCLE
21 error errno 1
22 error # dev: `npm run development`
22 error Exit status 1
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 [ 1, true ]
I'm not sure what should I do, I google adding some npm modules, reinstalling, deleting cache, but I'm not sure what could be the cause. This works on my Windows Laragon machine. I've installed it on Ubuntu without any problem, but on Debian I cannot make it work. Ideas?
I'm experiencing the same issue with this message before the list of npm ERR that you have posted :
Node Sass could not find a binding for your current environment: OS X
64-bit with Node.js 12.x
Found bindings for the following environments:
- OS X 64-bit with Node.js 7.x
This usually happens because your environment has changed since
running npm install. Run npm rebuild node-sass to download the
binding for your current environment.
As you say that you have installed your project on windows and Ubuntu before to try on your fresh Debian install, you maybe have the same problem.

Laravel 5.4 npm run dev error: Error: Cannot find module 'lodash._baseclone'

I am trying to run following command: npm run dev. However, it is giving an error as
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
module.js:471
throw err;
^
Error: Cannot find module 'lodash._baseclone'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/var/www/html/korsall-clean/node_modules/node-
notifier/node_modules/lodash.clonedeep/index.js:9:17)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
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/ubuntu/.npm/_logs/2017-06-07T10_34_11_411Z-
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/ubuntu/.npm/_logs/2017-06-07T10_34_11_426Z-
debug.log
I have removed node_modules folder and re-installed it, but still it is giving same error.
Please guide me wher
There is a very similar error that I found in this thread: https://github.com/meteor/meteor/issues/7221#issuecomment-226595754
There is a comment there that says the problem is related to the windows max path limitation of 260 characters. I tend to believe this is correct since I know I don't have the problem on my device that has the long paths enabled in windows - https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation
I'm getting the crash on my build server which is running another version of windows.
Try this npm i --save lodash._baseclone

Laravel Mix Error

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.

Resources