-1

I'm trying to install an NPM package called WebStatic to be used in a site I'm working on, but the path it's giving me an error for keeps looking at the drive I'm in twice.

Here's the error I've been getting: Cannot find module 'D:\c\Users\TomerK'sPC\AppData\Roaming\npm\node_modules\web-static\static.js'

I suspect that the problem has to do with node trying to consistently go straight from my D drive to my C drive, but when I tried to run the same command (the command WebStatic is just called by typing in Static), I get the same error except it says:

Cannot find module 'C:\c\Users\TomerK'sPC\AppData\Roaming\npm\node_modules\web-static\static.js'

I was wondering how to change the path so that it doesn't check the C drive twice? I'm guessing that the problem has something to do with my environment variables.

Tomer
  • 1
  • 5
  • npm is typically used for *nix based installations, not Windows. Are you certain you've got a Windows version of npm (or the Linux Subsystem for Windows version) to use? – Ken White Feb 05 '19 at 03:42
  • Yes, I installed the Windows version off of the main NodeJS site. – Tomer Feb 05 '19 at 14:36

1 Answers1

0

Try the following:

  1. -g is not a way to install global libraries, it's only a way to place them on system path so you can call them from command line without writing the full path to them. It is useful, for example, then node app is converting local files, like less — if you install it globally you can use it in any directory.

  2. node.js itself didn't look at the npm global dir, it is using another algorithm to find required files: http://nodejs.org/api/modules.html#modules_file_modules (basically its scanning every folder in the path, starting from the current for node_modules folder and checks it).

See similar question for more details: How do I install a module globally using npm?

Riaz Ahmed
  • 37
  • 1
  • 2