npx command not found

孤者浪人 提交于 2019-11-29 10:31:44

问题


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


回答1:


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



回答2:


if you are using Linux system, use sudo command

sudo npm i -g npx



回答3:


check versions of node, npm, npx as given below. if npx is not installed then use npm i -g npx

node -v
npm -v
npx -v



回答4:


if you are using macOS, use sudo command

sudo npm install -g npx




回答5:


Updating node helped me, whether that be from the command line or just re-downloading it from the web




回答6:


I returned to a system after a while, and even though it had Node 12.x, there was no npx or even npm available. I had installed Node via nvm, so I removed it, reinstalled it and then installed the latest Node LTS. This got me both npm and npx.



来源:https://stackoverflow.com/questions/49894620/npx-command-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!