After running npm run dev recieved message "Failed to exec dev script"
Dependencies are missing for fresh installation backdating to against an exisiting Laravel 5.3 app
Using an existing Laravel 5.3 app (all API driven, but it would be good to add a simple UI to update the data).
gulpfile.jsyarn.lock filenode_modules directoryyarn add laravel-mixwebpack.config.js and webpack.mix.js to home directory.packages.jsonnpm run devI was able to work around the issue and get to a working instance by:
yarn add [email protected]yarn add graceful-fswebpack --progress --hide-modules instead of the script0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/6.3.1/bin/node',
1 verbose cli '/Users/dfurman/.node/bin/npm',
1 verbose cli 'run',
1 verbose cli 'dev' ]
2 info using [email protected]
3 info using [email protected]
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: /Users/dfurman/.node/lib/node_modules/npm/bin/node-gyp-bin:/Users/dfurman/Code/web/routing/node_modules/.bin:/Users/dfurman/.node/bin:/Users/dfurman/.composer/vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/local/MacGPG2/bin
10 verbose lifecycle @~dev: CWD: /Users/dfurman/Code/web/routing
11 silly lifecycle @~dev: Args: [ '-c',
11 silly lifecycle 'cross-env NODE_ENV=development webpack --watch --progress --hide-modules' ]
12 info lifecycle @~dev: Failed to exec dev script
13 verbose stack Error: @ dev: `cross-env NODE_ENV=development webpack --watch --progress --hide-modules`
13 verbose stack spawn ENOENT
13 verbose stack at ChildProcess.<anonymous> (/Users/dfurman/.node/lib/node_modules/npm/lib/utils/spawn.js:33:16)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at ChildProcess.emit (events.js:191:7)
13 verbose stack at maybeClose (internal/child_process.js:852:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
14 verbose pkgid @
15 verbose cwd /Users/dfurman/Code/web/routing
16 error Darwin 15.6.0
17 error argv "/usr/local/Cellar/node/6.3.1/bin/node" "/Users/dfurman/.node/bin/npm" "run" "dev"
18 error node v6.3.1
19 error npm v4.1.1
20 error file sh
21 error code ELIFECYCLE
22 error errno ENOENT
23 error syscall spawn
24 error @ dev: `cross-env NODE_ENV=development webpack --watch --progress --hide-modules`
24 error spawn ENOENT
25 error Failed at the @ dev script 'cross-env NODE_ENV=development webpack --watch --progress --hide-modules'.
25 error Make sure you have the latest version of node.js and npm installed.
25 error If you do, this is most likely a problem with the package,
25 error not with npm itself.
25 error Tell the author that this fails on your system:
25 error cross-env NODE_ENV=development webpack --watch --progress --hide-modules
25 error You can get information on how to open an issue for this project with:
25 error npm bugs
25 error Or if that isn't available, you can get their info via:
25 error npm owner ls
25 error There is likely additional logging output above.
26 verbose exit [ 1, true ]
@JeffreyWay ,
Would you be interested in a PR for including webpack and graceful-fs as dependencies to laravel-mix?
Aside: Long-time listener, first-time caller ;) I'm loving the simplified laravel-mix framework and I'm excited to cut my current projects over to it. Keep up the awesomeness!
Result is replicated using Node 7.4.0 (tested from my other rig).
Same here, installed with yarn.
> cross-env NODE_ENV=development webpack --watch --progress --hide-modules
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn webpack ENOENT
at exports._errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:359:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:607:11)
at run (bootstrap_node.js:420:7)
at startup (bootstrap_node.js:139:9)
at bootstrap_node.js:535:3
npm ERR! Linux 4.8.13-1-ARCH
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
npm ERR! node v7.4.0
npm ERR! npm v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! [email protected] dev: `cross-env NODE_ENV=development webpack --watch --progress --hide-modules`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script 'cross-env NODE_ENV=development webpack --watch --progress --hide-modules'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the helpmepyz 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 webpack --watch --progress --hide-modules
@djfurman - Hmm, Webpack already is a dependency of Laravel Mix.
That's odd. Since we both installed with yarn I'll nuke my node_modules folder and try with npm direct install. Maybe it's a yarn issue? I'll let you know the results this evening.
Thanks for the quick response!
@rikless I'm using Yarn also here, but there is no issue at all (in here :D). I guess, it isn't an issue, it just because you don't have cross-env or webpack globally.
@nmfzone Actually, I have boths :) I was just talking about yarn to give more context ;)
@rikless Haha, so I'm completely wrong about it.馃槤 I just guess because I've got an error like that before. And the problem I don't have webpack globally.
@nmfzone WOUPS, to be sure, I've installed it again, and now it works ! Just compiled with webpack last week, and it worked, so I don't understand, but thanks :)
@rikless hmmm 馃槙 So, I'm not wrong about it ;) Anyway, good to see it works.
@JeffreyWay I think to be clear, need some note in the docs before using Mix, make sure "you" have cross-env and webpack globally. If I've enough time, maybe I'll send PR.
Installing both webpack & cross-env works locally (in the project) too. I see both listed in the packages.json dependencies so why they aren't being pulled in confuses me, but we do have a work around!
@ricardocanelas Have you read other comments above?
@nmfzone Sorry, I deleted my commented, because it was my mistake.. I wrote 'resource', and should be 'resources'. Thanks
@ricardocanelas Whoops, nope. Good to see it works.
I've encountered this as well. When using yarn to install modules, cross-env seems to be missing, but with npm install there is no problem. Could there be something that is run by npm but not by yarn?
This is an issue with yarn: https://github.com/yarnpkg/yarn/issues/1487.
Yeah this is a Yarn issue. Nothing for us to do until it gets fixed on their end. There are 571 open issues right now, so I'm just using good ole npm install right now. I recommend the same.
Most helpful comment
@rikless hmmm 馃槙 So, I'm not wrong about it ;) Anyway, good to see it works.
@JeffreyWay I think to be clear, need some note in the docs before using Mix, make sure "you" have
cross-envandwebpackglobally. If I've enough time, maybe I'll send PR.