npx not found, thought it is in the PATH

Viewed 5746

I'm setting up a local environment for the React Tutorial and I'm having some issues.

What version of node do I have?

$ node -v
v10.10.0

Set up the tutorial environnment

$ npm install -g create-react-app
/opt/nodejs/bin/create-react-app -> /opt/nodejs/lib/node_modules/create-react-app/index.js
+ create-react-app@1.5.2
added 67 packages from 20 contributors in 9.879s

Execute the instructions for tutorial setup:

$ npx create-react-app my-app
-bash: npx: command not found

What?! is npx missing?

$ npx 
-bash: npx: command not found

Hmm. Use this solution (npx command not working):

$ npm i -g npx
/opt/nodejs/bin/npx -> /opt/nodejs/lib/node_modules/npx/index.js
+ npx@10.2.0
added 484 packages from 651 contributors in 34.539s

It's installed? For sure?

$ whereis npx
npx: /opt/nodejs/bin/npx

Right. I don't trust you. What's in that directory?

$ v /opt/nodejs/bin/
total 34468
lrwxrwxrwx 1 kingram kingram       45 Sep 17 17:04 create-react-app -> ../lib/node_modules/create-react-app/index.js
-rwxr-xr-x 1 xxxxxxx xxxxxxx 35291184 Sep  6 13:15 node
lrwxrwxrwx 1 xxxxxxx xxxxxxx       38 Sep  6 13:15 npm -> ../lib/node_modules/npm/bin/npm-cli.js
lrwxrwxrwx 1 xxxxxxx xxxxxxx       32 Sep 17 17:10 npx -> ../lib/node_modules/npx/index.js

Something looks wrong about that.

$ npx -v
-bash: npx: command not found

Back to the beginning. Maybe it's not built that way.

$ npx create-react-app my-app
-bash: npx: command not found

I was right not to trust you.

So. Any thoughts from experienced users?

ADDITIONAL INFO:

NPM version

$ npm -v
6.4.1

Where is npm?

$ which npm
/usr/bin/npm

"...you should be able to execute create-react-app on its own without the npx prefix..."

$ create-react-app my-app    
-bash: create-react-app: command not found
0 Answers
Related