Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am working with webpack and I need to execute ./node_modules/webpack/bin/webpack.js using npx. npx webpack would run the webpack binary (./node_modules/webpack/bin/webpack), but each time I execute npx webpack I get bash: npx: command not found.

I am using:

  • node: v9.5.0

  • npm: 5.6.0

  • nvm: 1.1.5

  • webpack: 3.11.0

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
759 views
Welcome To Ask or Share your Answers For Others

1 Answer

npx should come with npm 5.2+, and you have node 5.6 .. I found that when I install node using nvm for Windows, it doesn't download npx. so just install npx globally:

npm i -g npx

In Linux or Mac OS, if you found any permission related errors use sudo before it.

sudo npm i -g npx

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...