question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't Run > npm run dev

See original GitHub issue

(Ran testing steps, issue still occurred)

  • Laravel Mix Version: (Returns (empty))
  • Node Version v8.1.4
  • NPM Version 5.0.3
  • OS: Ubuntu 16.04.2 LTS in vagrant (host OS: same)

Description:

I’ve tried all the various solutions I have found online (including in other issue tickets here) and I’m still unable to get this to work in my Laravel installation.

I’m running in Vagrant, so I can easily destroy and rebuild my VM quickly, so nothing is off the table when it comes to debugging.

Steps To Reproduce:

  1. Installed NodeJS using the following command (as per the NodeJS site)
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -;
sudo apt-get install -y nodejs;
  1. cd /var/www/laravel
  2. npm install
  3. npm run dev returns the following output:
ubuntu@webdev:/var/www/laravel$ npm run dev

> @ dev /var/www/laravel
> npm run development


> @ development /var/www/laravel
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

sh: 1: cross-env: 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`
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!     /home/ubuntu/.npm/_logs/2017-07-13T21_39_35_953Z-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 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!     /home/ubuntu/.npm/_logs/2017-07-13T21_39_35_970Z-debug.log
ubuntu@webdev:/var/www/laravel$ 

Also, the contents of /home/ubuntu/.npm/_logs/2017-07-13T21_39_35_970Z-debug.log are:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'run', 'dev' ]
2 info using npm@5.0.3
3 info using node@v8.1.4
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:/var/www/laravel/node_modules/.bin:/home/ubuntu/bin:/home/ubuntu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/ubuntu/.composer/vendor/bin:/home/ubuntu/.config/composer/vendor/bin:/var/www/laravel
10 verbose lifecycle @~dev: CWD: /var/www/laravel
11 silly lifecycle @~dev: Args: [ '-c', 'npm run development' ]
12 silly lifecycle @~dev: Returned: code: 1  signal: null
13 info lifecycle @~dev: Failed to exec dev script
14 verbose stack Error: @ dev: `npm run development`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:283:16)
14 verbose stack     at emitTwo (events.js:125:13)
14 verbose stack     at EventEmitter.emit (events.js:213:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:125:13)
14 verbose stack     at ChildProcess.emit (events.js:213:7)
14 verbose stack     at maybeClose (internal/child_process.js:897:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
15 verbose pkgid @
16 verbose cwd /var/www/laravel
17 verbose Linux 4.4.0-83-generic
18 verbose argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "dev"
19 verbose node v8.1.4
20 verbose npm  v5.0.3
21 error code ELIFECYCLE
22 error errno 1
23 error @ dev: `npm run development`
23 error Exit status 1
24 error Failed at the @ dev script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]

Assistance would be appreciated.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:34 (5 by maintainers)

github_iconTop GitHub Comments

27reactions
simonecoscicommented, May 3, 2018

npm rebuild should solve

16reactions
benyankecommented, Jul 24, 2017

Anyone? Surely I can’t be the only one running laravel mix on an Ubuntu Server…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why I can not run Npm run dev? - Stack Overflow
First run npm install cross-env npm install. Then run npm run dev.
Read more >
Can't run NPM RUN DEV - Laracasts
Hi I'm​ trying to run NPM RUN DEV but I get this error message: > @ dev /Users/hjorturfreyrlarusson/websites/project > npm run development >...
Read more >
What to do when "npm run dev" is not working? (React)
I tried to start my application with “npm run dev” as it is a react / next.js app. The console gave me an...
Read more >
npm run dev Is Not Working In Laravel 8 - Error Fixed - YouTube
You will fix your error InchaeAllah in four steps, don't worry Music:https://www.youtube.com/watch?v=AOeY-nDp7hI&t=0s.
Read more >
Error on npm run dev with Laravel Project · Issue #2761 - GitHub
To anyone who's still not able to run the "npm run dev" command. Make sure to run the command through the debugger a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found