Skip to content

NPM cli never gets installed #476

Closed
Closed
@rotexhawk

Description

@rotexhawk

I am running version 1.1.7 and no matter what version of node I install the npm cli never get's installed. I can see that node files but when I go to node_modules it's empty.

Activity

shiitake

shiitake commented on Sep 20, 2019

@shiitake

I suspect this is because npm has moved their repository from https://github.com/npm/npm to https://github.com/npm/cli. When nvm attempts to download NPM it points to the old URL and fails.

I was able to work around this by manually downloading the npm release and copying it into the appropriate node_modules folder called npm.

Then I copied the files npm and npm.cmd from node_modules/npm/bin into the parent directory of the node version I was trying to install (e.g. C:\ProgramData\nvm\v10.16.3).

After that run nvm use 10.16.3 (or whichever version you've installed) it should work. Or at least that's what worked for me.

rotexhawk

rotexhawk commented on Sep 20, 2019

@rotexhawk
Author

Thanks @shiitake. That's what I am doing too but it defeats the purpose of nvm.

hmassoumi

hmassoumi commented on Oct 22, 2019

@hmassoumi

I personally give up. This is just too much. I am resorting to using Chocolately to mange my node installs on my Windows machine. I'll use Windows sandbox (Win10 1903 and above) if I want to experiment with a different version of node.

Nishkalkashyap

Nishkalkashyap commented on Nov 12, 2019

@Nishkalkashyap

In my case it was the network firewall of my company, which blocked the npm download URL. COnnecting mu PC to a personal network fixed the issue for me.

coreybutler

coreybutler commented on Nov 28, 2019

@coreybutler
Owner

NPM moved their repo, but version 1.1.7 addressed this. There are also occasions where the Node/npm install files are unavailable (Github outage, etc). I've opened #495 to address these concerns.

ellipticview

ellipticview commented on Dec 14, 2019

@ellipticview

Having the same problem, but I don't think this is caused by the install files being unavailable.
In the scenario below, there is no error message. The download is reported as complete, and the installation seems to be successful.
However, directory C:\Program Files\nodejs\node_modules is completely empty.

C:\>nvm install 12.13.0
Downloading node.js version 12.13.0 (64-bit)...
Complete
Creating C:\Users\MMAGAN\AppData\Roaming\nvm\temp

Downloading npm version 6.12.0... Complete
Installing npm v6.12.0...

Installation complete. If you want to use this version, type

nvm use 12.13.0

C:\>nvm use 12.13.0
Now using node v12.13.0 (64-bit)

C:\>npm -v
internal/modules/cjs/loader.js:797
    throw err;
    ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
    at internal/main/run_main_module.js:17:11 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
internal/modules/cjs/loader.js:797
    throw err;
    ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
�[90m    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)�[39m
�[90m    at Function.Module._load (internal/modules/cjs/loader.js:687:27)�[39m
�[90m    at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)�[39m
�[90m    at internal/main/run_main_module.js:17:11�[39m {
  code: �[32m'MODULE_NOT_FOUND'�[39m,
  requireStack: []
}

C:\>
rotexhawk

rotexhawk commented on Dec 16, 2019

@rotexhawk
Author

I have exactly the same issue ^. Installation passes without any errors but the npm folder is always empty. I followed the instructions and removed every instance of node/npm from my computer but it still doesn't work. I am behind a firewall but shouldn't we get an error if npm installation fails?

iprocha

iprocha commented on Apr 30, 2020

@iprocha

Any follow ups on that? I'm having exactly the same problem.

DarkLite1

DarkLite1 commented on May 3, 2020

@DarkLite1

Same issue here after installing nvm it reports that the installation of npm is downloaded and succesful. However, the folder C:\Program Files\nodejs\node_modules is completely empty. Although the following is present:

image

shastaxc

shastaxc commented on May 7, 2020

@shastaxc

Why is this ticket closed? This is still an issue.

DarkLite1

DarkLite1 commented on May 7, 2020

@DarkLite1

You're right, @coreybutler can you have another look at this please?

alexandergorban

alexandergorban commented on May 7, 2020

@alexandergorban

The error exists, without nvm works correctly
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'

Woozyman

Woozyman commented on Jul 10, 2020

@Woozyman

I have the same issue. I'm also on nvm 1.1.7 trying to get node 12.18.2 (LTS at the moment):

$ nvm version
1.1.7

$ nvm install 12.18.2
Downloading node.js version 12.18.2 (64-bit)... 
Complete
Creating C:\Users\[User]\AppData\Roaming\nvm\temp

Downloading npm version 6.14.5... Complete
Installing npm v6.14.5...

Installation complete. If you want to use this version, type

nvm use 12.18.2

$ nvm use 12.18.2
Now using node v12.18.2 (64-bit)

$ npm i
internal/modules/cjs/loader.js:969
  throw err;
  ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.
js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966
:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)  
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_ma
in.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
internal/modules/cjs/loader.js:969
  throw err;
  ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.
js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966
:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)  
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_ma
in.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

The folder "C:\Program Files\nodejs\node_modules" is totally empty.

MerlinOfCode

MerlinOfCode commented on Jul 10, 2020

@MerlinOfCode

Same thing here! I swear this has been happening to me since last night.

2 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @shiitake@coreybutler@iprocha@hmassoumi@shastaxc

        Issue actions

          NPM cli never gets installed · Issue #476 · coreybutler/nvm-windows