npm Command not found -- path variable issue?

(Jake Riordan) #1

I’m getting the command not found when I try run a command from npm scripts.

It’s just a simple webpack build command that won’t work if I use

npm run build

Here are my scripts

"scripts": {
    "dev": "webpack --mode development",
    "build": "webpack --mode production"
  }

I think it’s a path configuration, because if I run

./node_modules/.bin/webpack --mode development

the command works fine.

I’m using iTerm 2 with oh-my-zsh on mac

If you have any ideas that would be amazing!
Apologies if I should post this somewhere else! I’m at my wits end trying to figure it out!

Here’s the error I keep getting

sh: webpack: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! React_tut@1.0.0 dev: `webpack --mode development`
npm ERR! spawn ENOENT
0 Likes

(system) closed #2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

0 Likes