by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Jesse van der Pluijm
    @jessevdp
    When I install Node 10.x via NVM-Windows it installs NPM v5.6.0. When running any kind of NPM command it complains about not being compatible with Node 10.
    PS > node -v
    v10.0.0
    PS > npm -v
    npm WARN npm npm does not support Node.js v10.0.0
    npm WARN npm You should probably upgrade to a newer version of node as we
    npm WARN npm can't make any promises that npm will work with this version.
    npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
    npm WARN npm You can find the latest version at https://nodejs.org/
    5.6.0
    Also I can't seem to update NPM.
    PS > npm i -g npm
    npm WARN npm npm does not support Node.js v10.0.0
    npm WARN npm You should probably upgrade to a newer version of node as we
    npm WARN npm can't make any promises that npm will work with this version.
    npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
    npm WARN npm You can find the latest version at https://nodejs.org/
    npm ERR! path C:\Program Files\nodejs\npm.cmd
    npm ERR! code EEXIST
    npm ERR! Refusing to delete C:\Program Files\nodejs\npm.cmd: is outside C:\Program Files\nodejs\node_modules\npm and not a link
    npm ERR! File exists: C:\Program Files\nodejs\npm.cmd
    npm ERR! Move it away, and try again.
    I'm on Windows 10 Pro 64 bit. Running NVM 1.1.7
    jlynde
    @jlynde
    Having a real hard time getting this to work on Windows 10. I followed all of the instructions and removed (or renamed all of the node and npm directories recommended, etc. Then I installed nvm 1.1.7 using the supplied MSI Installer. I did see warnings about spaces in file names so I installed nvm to C:\nvm instead of the normal C:\Program Files\ directory that has a space in the name (just in case). I have also searched for solutions but had no success finding one. Can someone here help?
    ```
    PS C:\nvm> nvm version
    1.1.7
    PS C:\nvm> nvm on
    nvm enabled
    Now using node v8.9.4 (64-bit)
    PS C:\nvm> nvm use 8.9.4
    Now using node v8.9.4 (64-bit)
    PS C:\nvm> node -v
    v8.9.4
    PS C:\nvm> npm -v
    module.js:540
        throw err;
        ^
    
    Error: Cannot find module 'C:\nvm\nodejs\node_modules\npm\bin\npm-cli.js'
        at Function.Module._resolveFilename (module.js:538:15)
        at Function.Module._load (module.js:468:25)
        at Function.Module.runMain (module.js:684:10)
        at startup (bootstrap_node.js:187:16)
        at bootstrap_node.js:608:3
    module.js:540
        throw err;
        ^
    
    Error: Cannot find module 'C:\nvm\nodejs\node_modules\npm\bin\npm-cli.js'
        at Function.Module._resolveFilename (module.js:538:15)
        at Function.Module._load (module.js:468:25)
        at Function.Module.runMain (module.js:684:10)
        at startup (bootstrap_node.js:187:16)
        at bootstrap_node.js:608:3
    jlynde
    @jlynde
    Also... Does this look right? It does not appear that everything is being downloaded.
    $ find /c/nvm
    .
    ./elevate.cmd
    ./elevate.vbs
    ./install.cmd
    ./nodejs
    ./nodejs.ico
    ./nvm.exe
    ./settings.txt
    ./unins000.dat
    ./unins000.exe
    ./unins000.msg
    ./v10.16.3
    ./v10.16.3/node64.exe
    ./v10.16.3/node_modules
    ./v10.16.3/npm
    ./v10.16.3/npm.cmd
    ./v10.16.3/npx
    ./v10.16.3/npx.cmd
    ./v8.9.4
    ./v8.9.4/node.exe
    ./v8.9.4/node_modules
    ./v8.9.4/npm
    ./v8.9.4/npm.cmd
    ./v8.9.4/npx
    ./v8.9.4/npx.cmd
    @jlynde - NVM4W does not ship with an msi installer. There is only an exe. Did you download from the github repo? Your 2nd secreenshot looks to be using a posix shell, i.e. linux format. It's a little hard to tell what's going on in your environment. It's further complicated by the fact there was a hard-coded bug that shipped in npm 5.x.x (which is the default for Node 8.9.x).
    Corey Butler
    @coreybutler
    @dkjain - if you're installing NVM4W the first time, then yes, you must still uninstall old versions of node before using NVM4W. The NVM4W installer will attempt to do this for you, but sometimes there are challenges in environments with complex permissions.
    jlynde
    @jlynde
    @coreybutler Yes, my bad. I used the exe installer.
    @coreybutler Second screenshot was from Git Bash, but I had the same result when using PowerShell. For the moment, I have removed nvm and installed NodeJS 8.9.4 directly and things are working as expected. Since I have multiple projects, I would really like to get nvm working, though.
    Corey Butler
    @coreybutler
    @jlynde the npm issue you're experiencing is common when the environment had a prior version of Node.js installed, then nvm4w was installed without removing the original node installation.
    @jlynde I would also recommend using just the standard terminal shell until you've got it working. Powershell is also supported, but the standard terminal is as bare bones as you can get (i.e. easier to figure out what's going on)
    jlynde
    @jlynde
    @coreybutler Yes, I saw that in many posts. But I did uninstall (actually, I renamed the original directories) first as per the README.md file instructions. Is it necessary to reboot as well? I did not do that and don't recall reading that anywhere. Maybe that is the issue?
    Corey Butler
    @coreybutler
    git bash/cygwin mimic posix filepaths, i.e. non-standard for Windows.
    jlynde
    @jlynde
    @coreybutler OK. I will give it one more try and just use standard Windows CMD. I don't think a reboot should be required so I do not plan to do that unless you say I should.
    Corey Butler
    @coreybutler
    No reboot is necessary, though you may need to simply reopen the terminal after install. Renaming the old installation prior to installing NVM4W is not sufficient because that doesn't change the old PATH environment variable (which is the root cause of this problem... and what NVM4W maintains for you). If you want to keep the old version "just in case", I would just copy it somewhere else before uninstalling the original (followed by installing NVM4W).
    jlynde
    @jlynde

    @coreybutler OK. I Uninstalled Node.js using Add/Remove Programs...
    Then I deleted the directories from C:\Program Files\ and C:\Users\john.lynde\AppData\Roaming\ (See below)
    Then I closed and re-opened the CMD Window
    Proof of previous installations having been removed:

    Microsoft Windows [Version 10.0.17134.1184]
    (c) 2018 Microsoft Corporation. All rights reserved.
    
    C:\Users\john.lynde>cd  "C:\Program Files\"
    
    C:\Program Files>dir n*
     Volume in drive C has no label.
     Volume Serial Number is 3CC6-C394
    
     Directory of C:\Program Files
    
    04/15/2019  12:31 PM    <DIR>          Notepad++
    12/16/2019  07:04 AM    <DIR>          NVIDIA Corporation
                   0 File(s)              0 bytes
                   2 Dir(s)  36,075,491,328 bytes free
    
    C:\Program Files>cd C:\Users\john.lynde\AppData\Roaming
    
    C:\Users\john.lynde\AppData\Roaming>dir n*
     Volume in drive C has no label.
     Volume Serial Number is 3CC6-C394
    
     Directory of C:\Users\john.lynde\AppData\Roaming
    
    01/06/2020  11:38 AM            32,204 NAMU_MsgDefaults.bin
    04/15/2019  12:31 PM    <DIR>          Notepad++
    01/25/2019  01:45 PM    <DIR>          NuGet
                   1 File(s)         32,204 bytes
                   2 Dir(s)  36,074,131,456 bytes free

    Then I installed (using the .exe) accepting the default installation location: C:\Users\john.lynde\AppData\Roaming\nvm and default Node.js Symlink: C:\Program Files\nodejs
    When that was finished, I closed and re-opened the CMD window once more to make sure it would pick up any PATH changes
    Finally, I tried again. nvm version works fine (as before) and says 1.1.7
    nvm install 8.9.4 seems to work, but...

    C:\Users\john.lynde>nvm install 8.9.4
    Downloading node.js version 8.9.4 (64-bit)...
    Complete
    Creating C:\Users\john.lynde\AppData\Roaming\nvm\temp
    
    Downloading npm version 5.6.0... Complete
    Installing npm v5.6.0...
    
    Installation complete. If you want to use this version, type
    
    nvm use 8.9.4
    
    C:\Users\john.lynde>nvm use 8.9.4
    Now using node v8.9.4 (64-bit)
    
    C:\Users\john.lynde>nvm on
    nvm enabled
    Now using node v8.9.4 (64-bit)
    
    C:\Users\john.lynde>node -v
    v8.9.4
    
    C:\Users\john.lynde>npm -v
    module.js:540
        throw err;
        ^
    
    Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
        at Function.Module._resolveFilename (module.js:538:15)
        at Function.Module._load (module.js:468:25)
        at Function.Module.runMain (module.js:684:10)
        at startup (bootstrap_node.js:187:16)
        at bootstrap_node.js:608:3
    module.js:540
        throw err;
        ^
    
    Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
        at Function.Module._resolveFilename (module.js:538:15)
        at Function.Module._load (module.js:468:25)
        at Function.Module.runMain (module.js:684:10)
        at startup (bootstrap_node.js:187:16)
        at bootstrap_node.js:608:3
    Similar (but different) result for 10.16.3 -- Is there any other version you would like me to try? These are the two that I need, unfortunately.
    C:\Users\john.lynde>nvm install 10.16.3
    Downloading node.js version 10.16.3 (64-bit)...
    Complete
    Creating C:\Users\john.lynde\AppData\Roaming\nvm\temp
    
    Downloading npm version 6.9.0... Complete
    Installing npm v6.9.0...
    
    Installation complete. If you want to use this version, type
    
    nvm use 10.16.3
    
    C:\Users\john.lynde>nvm use 10.16.3
    Now using node v10.16.3 (64-bit)
    
    C:\Users\john.lynde>node -v
    v10.16.3
    
    C:\Users\john.lynde>npm -v
    internal/modules/cjs/loader.js:638
        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:636:15)
        at Function.Module._load (internal/modules/cjs/loader.js:562:25)
        at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
        at startup (internal/bootstrap/node.js:283:19)
        at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
    internal/modules/cjs/loader.js:638
        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:636:15)
        at Function.Module._load (internal/modules/cjs/loader.js:562:25)
        at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
        at startup (internal/bootstrap/node.js:283:19)
        at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
    Corey Butler
    @coreybutler
    run an echo %PATH% to make sure "C:\Program Files\nodejs\node_modules\npm\bin" is in it. Additionally, which version of Windows are you running?
    side note, you don't need to run "nvm on"... it's on by default
    image.png
    jlynde
    @jlynde
    I do NOT see the path entry you suggested should be there. And the Windows version is Windows 10 Enterprise 10.0.17134 Build 17134
    Corey Butler
    @coreybutler
    I suspect permissions issues. Are you seeing the prompt like the screenshot above?
    jlynde
    @jlynde
    Nope.
    Corey Butler
    @coreybutler
    C:\Users\cbutler>nvm install 10.16.3
    Downloading node.js version 10.16.3 (64-bit)...
    Complete
    Creating C:\Users\cbutler\AppData\Local\nvm\temp
    
    Downloading npm version 6.9.0... Complete
    Installing npm v6.9.0...
    
    Installation complete. If you want to use this version, type
    
    nvm use 10.16.3
    
    C:\Users\cbutler>nvm use 10.16.3
    Now using node v10.16.3 (64-bit)
    
    C:\Users\cbutler>npm -v
    6.9.0
    
    C:\Users\cbutler>nvm install 8.9.4
    Downloading node.js version 8.9.4 (64-bit)...
    Complete
    Creating C:\Users\cbutler\AppData\Local\nvm\temp
    
    Downloading npm version 5.6.0... Complete
    Installing npm v5.6.0...
    
    Installation complete. If you want to use this version, type
    
    nvm use 8.9.4
    
    C:\Users\cbutler>nvm use 8.9.4
    Now using node v8.9.4 (64-bit)
    
    C:\Users\cbutler>npm -v
    5.6.0
    I can't recreate (see ^^)
    Remember to run the shell as an administrator
    Windows requires elevated administrative privileges to create symlinks in protected directories (like C:\Program Files). Your original approach of installing in C:\nvm could work as well, but again, it depends on which permissions the user account has.
    jlynde
    @jlynde
    Are there any log files created that would show the permissions issue? I guess I will try one last time installing in C:\nvm...
    jlynde
    @jlynde
    Well, darn. That did not work, either. So unless there are some logs that would help I guess I have no other choice than to give up and just install and uninstall manually each time I need to make a switch. Bummer
    Corey Butler
    @coreybutler
    There might be logs in the event system viewer, but permission issues aren't typically logged. You could also add the npm path manually, but it would be very strange to have to do that.
    jlynde
    @jlynde
    OK. Well, thanks for trying anyway!
    Corey Butler
    @coreybutler
    Well that's super frustrating. I'm sorry, I really wish I knew what was going on. The only other thing I can think of is a proxy issue, perhaps npm didn't fully download.
    but given you're doing fresh installs, I doubt it would be an NVM4W proxy configuration... corporate firewall?
    jlynde
    @jlynde
    Agreed. I spent quite a bit of time on this today Googling before using this forum. I was REALLY hoping to get this to work. But it is very possible that it is something that my company has done "protect us". Unfortunately, I just can't really spend any more time on this right now. I will just need to do things the old fashioned way for now. Again, thanks for your help!
    Corey Butler
    @coreybutler
    Your welcome. If you do find the root of the issue, please log it on Github. This particular experience is, unfortunately, a common symptom with many potential root causes. The more edge cases I'm aware of, the better the experience can be.
    jlynde
    @jlynde
    Will do!
    NShulzhenko
    @NShulzhenko
    Hi, just entered to help @jlynde cause had same issue
    this one what helped me so problem that npm folder is not copied in node_modules of installed with nvm node verison
    So I had same can not find npm-cli.js error but fixed using the article from above
    If You can automate that process this will fix issue for win10 users
    Adam
    @Poltergeisen
    Hi, just tried changing my nvm root directory and now im getting exec: "C:\\Git\\nvm\\elevate.cmd": file does not exist:
    does anyone know how to fix this issue?
    Renato Silva
    @rmsilva1973
    image.png
    Hey @coreybutler has anyone reported problems installing the LTS version of node with nvm?
    Renato Silva
    @rmsilva1973
    Never mind...
    Miclarsen1
    @Miclarsen1

    Hey all - I am seeing the same problem, and the problem seem to be using "nvm" to install a new version. I tried this with several different versions, including the current release, but the result is always the same.

    The version is listed as installed, and "nvm use" with the new version just installed works fine. However something must be going wrong during the installation, because when I look in the newly created root folder for that version, the "node_modules" folder that should contain a "npm" folder is empty, which tells me that the installation is incomplete

    The only version that currently works is the first on I installed, but all version are consistently incorrectly installed. The version folder itself is created and I can use the version, but seeing as the folder is empty it makes perfect sense this error is thrown, since the npm-cli.js file is literally not there.

    So files are missing after install, but the reason why has so far eluded me.

    Best regards,

    Michael

    jayasingh1
    @jayasingh1
    Hello! Has anyone run into the following? NVM is installed, a version of Node is installed via NVM, but nvm use <installed_node_version> fails with: fork/exec C:\Users\jaya\AppData\Roaming\nvm\elevate.cmd: The parameter is incorrect.: