Cigoler's avatar

Can't run 'npm run dev' to utilise Laravel mix

Whether I use a custom built ubuntu host, or a vagrant homestead instance, I can't get npm run dev to work. It always errors out initially complaining about cross-env, which I then install, and after that complains about spawn webpack ENOENT;

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: spawn node_modules/webpack/bin/webpack.js ENOENT
    at exports._errnoException (util.js:1020:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:197:32)
    at onErrorNT (internal/child_process.js:376:16)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
    at Module.runMain (module.js:606:11)
    at run (bootstrap_node.js:383:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:496:3

I have my nginx server working serving the files and everything but I can't edit the scss because it won't compile.

Now I've tried;

sudo rm -R node_modules
sudo npm install

I also cleared the cache, but still no dice. Any assistance greatly appreciated!

0 likes
3 replies
rin4ik's avatar

try please

rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install
1 like
Cigoler's avatar

I did try that already @rin4ik only the second command it failed because neither file existed

ejdelmonico's avatar
Level 53

I would suspect it is a permissions error because of the use of sudo. npm install in the project should not require sudo. sudo would be used to install a package globally only. So, since you are using sudo to install local project packages, did you try sudo npm run dev?

1 like

Please or to participate in this conversation.