1

As instructed by my school, I was trying to install "npx create-react-app@3.3.0 nucampsite" but it opens up visual studio code with the file npm-cli.js

I tried running the command from Visual Studio Code and I got this error message:

C:\Users\Jay\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:1
npm/usr/bin/nodejs
^

ReferenceError: npm is not defined
   at Object.<anonymous> (C:\Users\Jay\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:1:1)
   at Module._compile (internal/modules/cjs/loader.js:1138:30)
   at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
   at Module.load (internal/modules/cjs/loader.js:986:32)
   at Function.Module._load (internal/modules/cjs/loader.js:879:14)
   at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
   at internal/main/run_main_module.js:17:47

On line 1 on Visual Studio Code this is what I have:

npm/usr/bin/nodejs 
RobC
  • 16,905
  • 14
  • 51
  • 62
Jay Pirani
  • 11
  • 2
  • What is the result of that command: `node -v && npm -v && npx -v`? – Arseniy-II Jul 01 '20 at 15:17
  • so when i ran node -v its showing v12.18.2. when i ran the npm -v and npx-v C:\Users\Amraze Pirani\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:1 npm/usr/bin/nodejs ^ ReferenceError: npm is not defined at Object. I feel like its something related to the npm-cli.js file since i edited the first line of that file – Jay Pirani Jul 01 '20 at 15:26
  • basically its showing the same error message like i got above – Jay Pirani Jul 01 '20 at 15:31
  • Looks like you some how managed to install `node` but not `npm` and `npx`. Please try to reinstall `node`. After installation you should have `node` and `npm` and `npx`. PS: please use " ` " to highlight code parts of your message in comments :) – Arseniy-II Jul 02 '20 at 06:45

2 Answers2

0

The code you wrote is correct, however - run this in your VS Code terminal:

npm --version

If it doesn't give you a version of npm, it means you don't have it installed, which is most likely the problem.

See this page to install it.

0

Fixed! I uninstalled node and npm and then reinstalled it back and it seemed to work perfectly! thank you guys!

Jay Pirani
  • 11
  • 2