laravel-mix: Dependencies missing for install & Fail to exec dev script

Observed Behavior

After running npm run dev recieved message “Failed to exec dev script”

Suspected Cause

Dependencies are missing for fresh installation backdating to against an exisiting Laravel 5.3 app

Reproduction Steps

Using an existing Laravel 5.3 app (all API driven, but it would be good to add a simple UI to update the data).

  1. Delete gulpfile.js
  2. Delete yarn.lock file
  3. Recursively delete node_modules directory
  4. Run yarn add laravel-mix
  5. Copy webpack.config.js and webpack.mix.js to home directory.
  6. Copy scripts from npm-scripts laravel-mix documentation to packages.json
  7. Run npm run dev

Local Stack

  • Node v6.3.1
  • NPM v4.1.1

Work Around

I was able to work around the issue and get to a working instance by:

  1. Manually install webpack 2.2.0-rc.4 yarn add webpack@2.2.0-rc.4
  2. Manually install graceful-fs yarn add graceful-fs
  3. Run webpack --progress --hide-modules instead of the script

NPM Error Log

0 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 npm@4.1.1
3 info using node@v6.3.1
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 ]

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (2 by maintainers)

Most upvoted comments

@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.

@ricardocanelas Whoops, nope. Good to see it works.