0

I've installed Node JS on my laptop to learn it locally. It's windows 7 64bit.

I ran the installer which was all fine. However, whenever I try and do anything with npm I get the following error.

Has anyone else experienced this error? I've tried uninstalling and reinstalling to no avail.

Looking at the error it seems to be looking for something on the path Object. (C:\Users\CHANGED_FOR_PRIVACY\AppData\Roaming\npm\node_modules\

But there is nothing actually in that directory/path so do i need to alter a path somewhere? Also, I changed the name of the directory for privacy in this example.

Drongo

   $ npm --version
module.js:327
    throw err;
    ^

Error: Cannot find module 'strip-ansi'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (C:\Users\CHANGED_FOR_PRIVACY\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:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
2
  • Did you try updating npm? npm install npm -g Commented Jul 6, 2016 at 21:36
  • I get the same error when running that too :/ Commented Jul 6, 2016 at 22:10

1 Answer 1

3

When I've run into issues like this on Windows with NPM I just fresh install NPM. You can use Cygwin and cURL to install NPM without the node installer.

Download Cygwin

Launch Cygwin Terminal as Administrator, then run the following command

curl -L "https://npmjs.org/install.sh" | sh

This will do a fresh install of NPM. It could take a while to download but once the install completed if everything was successful, the last thing printed will be It Worked.

That should correct your issue.

Sign up to request clarification or add additional context in comments.

1 Comment

this was just the ticket mate. Thank you so much for the help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.