New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependencies missing for install & Fail to exec dev script #94

Closed
djfurman opened this Issue Jan 13, 2017 · 17 comments

Comments

Projects
None yet
7 participants
@djfurman

djfurman commented Jan 13, 2017

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 ]

@djfurman

This comment has been minimized.

djfurman commented Jan 13, 2017

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

@djfurman

This comment has been minimized.

djfurman commented Jan 14, 2017

Result is replicated using Node 7.4.0 (tested from my other rig).

@rikless

This comment has been minimized.

rikless commented Jan 14, 2017

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! helpmepyz@1.0.0 dev: `cross-env NODE_ENV=development webpack --watch --progress --hide-modules`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the helpmepyz@1.0.0 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
@JeffreyWay

This comment has been minimized.

Owner

JeffreyWay commented Jan 14, 2017

@djfurman - Hmm, Webpack already is a dependency of Laravel Mix.

@djfurman

This comment has been minimized.

djfurman commented Jan 14, 2017

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!

@nmfzone

This comment has been minimized.

nmfzone commented Jan 14, 2017

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

@rikless

This comment has been minimized.

rikless commented Jan 14, 2017

@nmfzone Actually, I have boths :) I was just talking about yarn to give more context ;)

@nmfzone

This comment has been minimized.

nmfzone commented Jan 14, 2017

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

@rikless

This comment has been minimized.

rikless commented Jan 14, 2017

@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 :)

@nmfzone

This comment has been minimized.

nmfzone commented Jan 14, 2017

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

@djfurman

This comment has been minimized.

djfurman commented Jan 17, 2017

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!

@nmfzone

This comment has been minimized.

nmfzone commented Jan 18, 2017

@ricardocanelas Have you read other comments above?

@ricardocanelas

This comment has been minimized.

ricardocanelas commented Jan 18, 2017

@nmfzone Sorry, I deleted my commented, because it was my mistake.. I wrote 'resource', and should be 'resources'. Thanks

@nmfzone

This comment has been minimized.

nmfzone commented Jan 18, 2017

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

@bvangraafeiland

This comment has been minimized.

Contributor

bvangraafeiland commented Jan 21, 2017

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?

@adriaanzon

This comment has been minimized.

Contributor

adriaanzon commented Jan 21, 2017

This is an issue with yarn: yarnpkg/yarn#1487.

@JeffreyWay

This comment has been minimized.

Owner

JeffreyWay commented Jan 22, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment