2

I have installed node.js. Node seems to be working properly, however, npm is not being found, as you can see below.

    C:\Users\jpdrc>node -v
v6.5.0

C:\Users\jpdrc>node hello.js
node is installed!

C:\Users\jpdrc>npm -v
module.js:457
    throw err;
    ^
Error: Cannot find module 'strip-ansi'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\jpdrc\AppData\Roaming\npm\node_modules\npm\node_modules\npmlog\node_modules\gauge\node_modules\string-width\index.js:2:17)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)

I have tried multiple solutions as the ones presented:

1- Windows -installed node.js but npm not found

2- Installing Node.js (and npm) on Windows 10

I have no idea what to try next

Thanks for the assistance

Here are my variables under path

As suggested below I have used where npm

C:\Users\jpdrc>where npm
C:\Program Files\nodejs\npm
C:\Program Files\nodejs\npm.cmd
Community
  • 1
  • 1
jpdrcarneiro
  • 21
  • 1
  • 3

2 Answers2

0

Steps for solving the above issue:

  1. Check that you have added the path of node in environment variable "path"
  2. If it is there then check that npm is there in the directory which you have added in the path.
  3. If npm is there in the required folder then go to CMD and then go to directory where npm is installed and try to run the version command again. If still you are getting the same issue then there could be two possibilities:

    a. Installation is incorrect, try installing again

    b. There could be proxy issue due to which packages are not getting downloaded

There cannot be any other issue.

dvsakgec
  • 3,514
  • 4
  • 28
  • 35
0

You should be able to run the npm -v in the git bash terminal window. If you don't even have the git-bash app, then download and install git on your Windows.

William
  • 79
  • 2