Giter Club home page Giter Club logo

npm-windows-upgrade's Introduction

Upgrade npm on Windows

windows build status npm version dependencies Upgrading npm on Windows requires manual steps to ensure that PowerShell/CMD find the new version of npm. This is a small tool made with ❤️ for npm and Node, reducing the process to a simple command.

Usage

First, ensure that you can execute scripts on your system by running the following command from an elevated PowerShell. To run PowerShell as Administrator, click Start, search for PowerShell, right-click PowerShell and select Run as Administrator.

Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force

Then, to install and use this upgrader tool, run the following command (also from an elevated PowerShell or cmd.exe). Note: This tool requires at least Node v8, please install an older version for older versions of Node.js.

npm install --global --production npm-windows-upgrade
npm-windows-upgrade

Want to just install the latest version? Sure:

npm-windows-upgrade --npm-version latest

The tool will show you a list of all the published and available versions of npm (including pre-release and beta versions). Choose the one you want to install and let it do its thing!

Advanced Usage

Usage: npm-windows-upgrade [options]

Options:

-h, --help                        Output usage information
-V, --version                     Output the version number
-d, --no-dns-check                Disable the internet connectivity test
-e, --no-execution-policy-check   Disable the PowerShell execution policy test
-p, --no-spinner                  Disable the spinner animation
-n, --npm-path <path>             (Optional) If passed, npm will be upgraded in the specified location
-v, --npm-version <version>       (Optional) If passed, npm will be upgraded/downgraded to the specified version

If you have trouble with the script, consider adding parameters manually. A common issue is that the script fails to find npm (and therefore doesn't know where to install it) - in that case, pass the location manually.

npm-windows-upgrade --npm-path "C:\nodejs"

To manually specify a version to install, pass the version parameter:

npm-windows-upgrade --npm-version 5.5.0

To override the internet connection check, pass --no-dns-check. To disable the initial prompt, pass --no-prompt.

Debug Mode

To see debug output, set a DEBUG environment variable ($env:DEBUG="npm-windows-upgrade")

Issues & Support

Please do report your issues on GitHub. There are a bunch of Windows versions, hundreds of different ways to install Node and npm, and it's likely that this script won't work with a few of them. If you run into trouble and need npm upgraded as soon as possible, please follow the manual instructions.

This tool was made with ❤️ for npm and Node, but it is provided "as is", without warranty of any kind, expressed or implied. For details, please consult the LICENSE file.

Fix an Attempted Upgrade

Chances are that you attempted to upgrade npm before, it somehow failed, and you then went looking for this tool. If the tool fails to upgrade, it may be troubled by partial changes done during npm install npm or npm upgrade npm. In that case, you will have to completely uninstall Node:

  • Uninstall Node.js (select Uninstall, not the Repair option).
  • Go into %programfiles%\nodejs and delete the entire folder.
  • Delete %appdata%\npm and %appdata%\npm-cache.
  • Edit your PATH and remove everything that references npm (to do so, hit "Start" and search for "Environment Variables").
  • Reinstall Node, then install this tool - and only use this tool to upgrade npm, do not attempt to run npm install npm.

:memp: Used Chocolatey? If you used Chocolatey (https://chocolatey.org/) to install Node.js, be sure to check if npm is removed from the choco\bin directory by running the following command: where.exe npm. Should it still be there, you will need to either choco uninstall npm or delete the files from this bin directory.

Older Node.js Versions

More Useful Node.js Stuff

Microsoft is working hard to make sure that our users have the best possible experience with Node.js. For a helpful set of content that makes it easier to avoid any potential gotchas, go check out our Node.js Guidelines - a collection of tips and advanced best practices!

Contributing

Contributions are extremely welcome! For JavaScript code, please run grunt test to check your code against JSCS and JSHint. There's no formal coding guideline for the PowerShell pieces of this tool, but do write code that is commented and comprehensible.

License

MIT, please see LICENSE for details. Copyright (c) 2015 - 2017 Felix Rieseberg.

npm-windows-upgrade's People

Contributors

andischerer avatar bdukes avatar cchamberlain avatar cookieguru avatar felixrieseberg avatar ntregillus avatar olivierdagenais avatar piotr-cz avatar willediger avatar wkovacs64 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

npm-windows-upgrade's Issues

Windows 10 can't find ProgramFile path

I used ${env:ProgramFiles(x86)} everywhere I could and it fixed it on Windows 10.

# npm-windows-upgrade
# This script updates npm on Windows, making sure that the npm installed
# with `npm install -g npm@latest` is actually the first npm found in PATH
# (C) Copyright 2015 Microsoft, developed by Felix Rieseberg
# [email protected]

# ----------------------------------------------------------------------
# Usage: ./upgrade-npm.ps1
# ----------------------------------------------------------------------
[CmdletBinding()]
Param(
    [Parameter(Mandatory=$True)]
    [string]$version,
    [string]$NodePath=(Join-Path ${env:ProgramFiles(x86)} nodejs)
)

$ErrorActionPreference = "Stop"

#
# Self-Elevate
# ---------------------------------------------------------------------------------------------------------
function IsAdministrator
{
    $Identity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
    $Principal = New-Object System.Security.Principal.WindowsPrincipal($Identity)
    $Principal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)
}

function IsUacEnabled
{
    (Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System).EnableLua -ne 0
}

function UpdateNpm($PassedNodePath)
{
    $NpmPath = (Join-Path $PassedNodePath "node_modules\npm")
    Write-Debug "Assuming npm in $NpmPath"

    if (Test-Path $PassedNodePath)
    {
        # Create tmp directory, delete files if they exist
        $TempPath = "$env:temp\npm_upgrade"
        if ((Test-Path $TempPath) -ne $True)
        {
            New-Item -ItemType Directory -Force -Path $TempPath
        }

        # Copy away .npmrc
        $Npmrc = $False
        if (Test-Path $NpmPath)
        {
            cd $NpmPath

            if (Test-Path .npmrc)
            {
                $Npmrc = $True
                Write-Debug "Saving .npmrc"
                Copy-Item .npmrc $TempPath
            }
        }

        # Upgrade npm
        cd $PassedNodePath
        Write-Debug "Upgrading npm in $PassedNodePath"
        .\npm install npm@$version

        # Copy .npmrc back
        if ($Npmrc)
        {
            Write-Debug "Restoring .npmrc"
            $TempFile = "$TempPath\.npmrc"
            Copy-Item $TempFile $NpmPath -Force
        }

        "All done!"
    } else
    {
        "Could not find installation location (assumed in $PassedNodePath) - aborting upgrade"
    }
}

if (!(IsAdministrator))
{
    if (IsUacEnabled)
    {
        "We need to relaunch this script as administrator"
        [string[]]$argList = @('-NoProfile', '-NoExit', '-File', $MyInvocation.MyCommand.Path)
        $argList += $MyInvocation.BoundParameters.GetEnumerator() | Foreach {"-$($_.Key)", "$($_.Value)"}
        $argList += $MyInvocation.UnboundArguments
        Start-Process PowerShell.exe -Verb Runas -WorkingDirectory $pwd -ArgumentList $argList
        return
    }
    else
    {
        "You must be administrator to run this script"
        return
    }
}

#
# Upgrade
# ---------------------------------------------------------------------------------------------------------
$AssumedNpmPath = (Join-Path $NodePath "node_modules\npm")

if ((Test-Path $AssumedNpmPath) -ne $True)
{
    $NodePath = (Join-Path ${env:ProgramFiles(x86)} nodejs)
    # If the user installed an x86 version of NodeJS on an x64 system, the NodeJS installation will be found
    # in env:ProgramFiles(x86)
    if ((Test-Path $NodePath) -ne $True) {
        if (Test-Path "Env:ProgramFiles(x86)")
        {
            $NodePath = (Join-Path ${env:ProgramFiles(x86)} nodejs)
        }
        else
        {
            "We could not find npm - aborting upgrade"
            return
        }
    }
}

UpdateNpm($NodePath)

Cannot read property 'indexOf' of undefined

Looks like a problem parsing the powershell output. The error occurred just after Upgrading npm in C:\Program Files\nodejs appeared in the powershell window.

Upgrade did complete successfully.

Upgrading.. \

C:\Users\btp\AppData\Roaming\npm\node_modules\npm-windows-upgrade\bin\npm-windows-upgrade:65
        } else if (output[output.length - 1].indexOf('All done!') > -1) {
                                            ^
TypeError: Cannot read property 'indexOf' of undefined
    at C:\Users\btp\AppData\Roaming\npm\node_modules\npm-windows-upgrade\bin\npm-windows-upgrade:65:45
    at ChildProcess.<anonymous> (C:\Users\btp\AppData\Roaming\npm\node_modules\npm-windows-upgrade\bin\npm-windows-upg
rade:29:9)
    at ChildProcess.emit (events.js:110:17)
    at Process.ChildProcess._handle.onexit (child_process.js:1074:12)

Cannot Upgrade To Any Version

Anytime I try to upgrade, the script fails with the following screen:
http://i.imgur.com/bT3eLxp.png

The 'Here is the error:' block is always empty so I am not sure as to why this is failing. It has always worked in the past, but tonight it does not seem to want to cooperate.

Error upgrading npm

I am following the instructions step by step. npm-windows-upgrade installed successfully.
But when I run npm-windows-upgrade --npm-path:"C:\NodeJS" --version:3.3.9, I got error.

Output from elevated powershell:

npm-windows-upgrade --npm-path:"C:\NodeJS" --version:3.3.9
npm-windows-upgrade 0.4.8
? This tool will upgrade npm. Do you want to continue? (Y/n) y
? This tool will upgrade npm. Do you want to continue? Yes
Upgrading... -Error:  npm
Error:   ERR! Windows_NT 10.0.10240

Error:  npm
Error:  ERR! argv "C:\\NodeJS\\node.exe" "C:\\NodeJS\\node_modules\\npm\\bin\\npm-cli.js" "install" "[email protected]"

Error:  npm ERR! node
Error:   v4.2.1
npm ERR!
Error:  npm  v2.14.7
npm
Error:   ERR! path C:\NodeJS\node_modules\npm
npm
Error:   ERR! code EPERM

Error:  npm ERR! errno -4048

Error:  npm ERR! syscall lstat

Error:

Error:  npm
Error:   ERR! Error: EPERM: operation not permitted, lstat 'C:\NodeJS\node_modules\npm'
npm ERR!
Error:       at Error (native)
npm ERR!  { [Error: EPERM: operation not permitted, lstat 'C:\NodeJS\node_modules\npm']

Error:  npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',

Error:  npm
Error:  ERR!   syscall: 'lstat',
npm ERR!   path: 'C:\\NodeJS\\node_modules\\npm' }

Error:  npm ERR!
npm ERR!
Error:   Please try running this command again as root/Administrator.

Error:  npm
Error:  ERR! error rolling back Error: EPERM: operation not permitted, lstat 'C:\NodeJS\node_modules\npm'
npm
Error:   ERR! error rolling back     at Error (native)
npm ERR! error rolling back  { [Error: EPERM: operation not permitted, lstat 'C:\NodeJS\node_modules\npm']
npm
Error:  ERR! error rolling back   errno: -4048,
npm ERR! error rolling back   code: 'EPERM',
npm ERR! error rolling back   syscall: 'lstat',

Error:  npm
Error:
Error:  ERR!
Error:
Error:  error rolling back
Error:     path: 'C:\\NodeJS\\node_modules\\npm' }

Error:

Error:  npm ERR! Please include the following file with any support request:
npm ERR!     C:\NodeJS\npm-debug.log

Upgrading... \

My npmrc

prefix = C:\NodeJS
cache = C:\NodeJS\npm-cache
init-module = C:\NodeJS\npm-init.js
globalconfig = C:\NodeJS\etc\npmrc
globalignorefile = C:\NodeJS\etc\npmignore
userconfig = C:\NodeJS\etc\npmrc

npm-debug.log > https://gist.github.com/zmni/9217b2e84bc91ccba0fc

Unexpected token p

might be related to #15 and #13

PS C:\WINDOWS\system32> Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
PS C:\WINDOWS\system32> node -v
v0.12.7
PS C:\WINDOWS\system32> npm -v
2.11.3
PS C:\WINDOWS\system32> npm-windows-upgrade
npm-windows-upgrade 0.2.10
? This tool will upgrade npm. Do you want to continue? Yes
undefined:1
npm command view
 ^
SyntaxError: Unexpected token p
    at Object.parse (native)
    at C:\Users\falei\AppData\Roaming\npm\node_modules\npm-windows-upgrade\bin\npm-windows-upgrade:73:17
    at ChildProcess.exithandler (child_process.js:742:7)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Socket.<anonymous> (child_process.js:1183:11)
    at Socket.emit (events.js:107:17)
    at Pipe.close (net.js:485:12)
PS C:\WINDOWS\system32> 
PS C:\WINDOWS\system32> npm-windows-upgrade --version:3.1.0
npm-windows-upgrade 0.2.10
? This tool will upgrade npm. Do you want to continue? Yes
Upgrading.. -Error:  Join-Path : Cannot find drive. A drive with the name 'npm command configC' does not exist.

Error:  At C:\Users\falei\AppData\Roaming\npm\node_modules\npm-windows-upgrade\powershell\upgrade-npm.ps1:103 char:20
+ $AssumedNpmPath = (Join-Path $NodePath "node_modules\npm")
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (npm command configC:String) [Join-Path], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.JoinPathCommand




You wanted to install npm 3.1.0, but the installed version is2.11.3.
Please consider reporting your trouble to http://aka.ms/npm-issues.
Here is the output from the upgrader script:
[] [ 'Join-Path : Cannot find drive. A drive with the name \'npm command configC\' does not exist.\r\n',
  'At C:\\Users\\falei\\AppData\\Roaming\\npm\\node_modules\\npm-windows-upgrade\\powershell\\upgrade-npm.ps1:103 char:2
0\r\n+ $AssumedNpmPath = (Join-Path $NodePath "node_modules\\npm")\r\n+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~\r\n    + CategoryInfo          : ObjectNotFound: (npm command configC:String) [Join-Path], DriveNotFoundExcept
ion\r\n    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.JoinPathCommand\r\n \r\n' ]

Error updating npm 3.5.2 to 3.5.3

I was not able to install any packages with npm(some windows NT error), so I update node and tried to update npm

https://github.com/felixrieseberg/npm-windows-upgrade as this suggested.

I started power shell as administrator
Entered command as suggested

  1. Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
  2. npm install -g npm-windows-upgrade

on
npm install -g npm-windows-upgrade
I selected 3.5.3
this shows me the error

Upgrading... /Error:  npm
Upgrading... -Error:
Error:  WARN
Error:
Error:  enoent
Error:   ENOENT: no such file or directory, open 'C:\Program Files\nodejs\package.json'

Error:  npm
Error:
Error:  WARN
Error:   nodejs No description

Error:  npm WARN nodejs No repository field.
npm WARN nodejs No README data
npm WARN nodejs No license field.

Upgrading... /

You wanted to install npm 3.5.3, but the installed version is3.5.2.
Please consider reporting your trouble to http://aka.ms/npm-issues.
Here is the error:

Unable to install npm Windows 7 64 bit

Am getting this error

error

How to resolve, am trying to install phonegap after installing node.js (64 bit), which gives this error
32 error node v0.12.5
33 error npm v2.11.2

error running npm install, 'no such file or dir' for mkdirp\b and rimraf\b

I am getting the following error while trying to run this command. Any help would be greatly appreciated. Thanks!

C:\Users\dcollier
λ Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
C:\Users\dcollier
λ npm install -g npm-windows-upgrade npm-windows-upgrade
npm WARN install:mkdirp ENOENT: no such file or directory, chmod 'C:\Users\dcollier\AppData\Roaming\npm\node_modules\npm-windows-upgrade\node_modules\mkdirp\b'
npm WARN install:rimraf ENOENT: no such file or directory, chmod 'C:\Users\dcollier\AppData\Roaming\npm\node_modules\npm-windows-upgrade\node_modules\utile\node_modules\rimraf\b'
C:\Users\dcollier\AppData\Roaming\npm
└── (empty)

npm ERR! code 1
C:\Users\dcollier
λ

npm-windows-upgrade is installing wrong version

Hi
when I ran "npm-windows-upgrade" in powershell and choose 3.3.11 as the version to upgrade,system automatically does install for 3.4.1 which is not supposed to happen.Please check the attached file for more details.
Thanks

npm windows upgrade error

Override version selection

Would be nice to automatically select the latest version, so (together with #25) we can do a fully unattended upgrade. Something like

npm-windows-upgrade --quiet --version:latest

Or something. Currently doesn't work, as there's no version, or an alias for a version, called "latest".

Error Launching npm-windows-upgrade

I am following the instructions for upgrading NPM using npm-windows-upgrade.

The upgrade tool installs successfully, then I run npm-windows-upgrade.

PS C:\Users\Gregg> npm-windows-upgrade npm-windows-upgrade 0.4.6
? This tool will upgrade npm. Do you want to continue? Yes
events.js:85
throw er; // Unhandled 'error' event
^
Error: spawn powershell.exe ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickCallback (node.js:355:11)

I tried this with passing the path to the nodejs folder, and the result was the same.

This is being run on a Windows 7 Professional, Service Pack 1 64 bit box.

I ran this successfully on another machine which is a 2008R2 Server.

Greg

Failed to update from 2.13.0 to 3.1.3

I'm running io.js 2.4.0. The error message is similar to #10 but happens in upgrade-npm.ps1 rather than Microsoft.PowerShell.Commands.WriteDebugCommand if I'm reading it correctly:

PS C:\> npm-windows-upgrade
npm-windows-upgrade 0.2.6
? This tool will upgrade npm. Do you want to continue? (Y/n)
? This tool will upgrade npm. Do you want to continue? Yes
? Which version do you want to install? 3.1.3
Upgrading.. |Error:  C:\Users\Rosalie\AppData\Roaming\npm\node_modules\npm-windows-upgrade\powershell\upgrade-npm.ps1 :
Impossible de

Error:  trouver un param?tre positionnel acceptant l'argument ?env:ProgramFiles(x86)?.
Au caract?re Ligne:1 : 4
+ & {& 'C:\Users\Rosalie\AppData\Roaming\npm\node_modules\npm-windows-upgrade\powe ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument : (:) [upgrade-npm.ps1], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,upgrade-npm.ps1




You wanted to install npm 3.1.3, but the installed version is2.13.0.
Please consider reporting your trouble to http://aka.ms/npm-issues.
Here is the output from the upgrader script:
[] [ 'C:\\Users\\Rosalie\\AppData\\Roaming\\npm\\node_modules\\npm-windows-upgrade\\powershell\\upgrade-npm.ps1 : Imposs
ible de \r\n',
  'trouver un param?tre positionnel acceptant l\'argument ?env:ProgramFiles(x86)?.\r\nAu caract?re Ligne:1 : 4\r\n+ & {&
 \'C:\\Users\\Rosalie\\AppData\\Roaming\\npm\\node_modules\\npm-windows-upgrade\\powe ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : InvalidArgument : (:) [upgrade-
npm.ps1], ParameterBindingException\r\n    + FullyQualifiedErrorId : PositionalParameterNotFound,upgrade-npm.ps1\r\n \r\
n' ]

I'm running the script on a PC with Windows 8 32-bit (EDIT: previously erroneously stated it was Windows 7) so while I have the 32-bit version of io.js, I don't have a Program Files (x86) folder... which the error log mentions so it could be related?

Breaks Tools for Apache Cordova and VS 2015

If you install VS 2015 first, then use this tool, it will break the Tools for Apache Cordova config so that VS can no longer build Apache Cordova packages. That's because it changes the -g prefix directory, so vs-tac and all the dependencies, which are installed under AppData by default, will appear to be missing.

Override "Confirm to update" prompt

First things first: Great tool, thanks a lot!

Feature Proposal:

It would be nice to be able to override the update confirmation prompt with a parameter, e.g. --no-prompt or --no-confirmation, just like --version.

Background:

I'm working on several native node modules on an automated build system (AppVeyor).
The modules are compiled with different node versions.
To get consistent npm behaviour I would like to use the same npm version with all node versions I'm targeting.

As quick fix, I completely removed the prompt for my automated builds:

inquirer.prompt({
type: 'confirm',
name: 'c',
message: 'This tool will upgrade npm. Do you want to continue?'
}, function (response) {

Installing a new npm version breaks without any response

Platform Win7

C:\>npm-windows-upgrade
npm-windows-upgrade 0.4.5
? This tool will upgrade npm. Do you want to continue? Yes
? Which version do you want to install? 2.14.8
Upgrading... -

C:\>

Installing a new npm version with --npm-path:"C:\tools\nodejs" cli-parameter set works.

Thanks for your work 👍

Error after upgrade ... but upgrade seems successful

@felixrieseberg I just updated to version 0.2.3 of npm-windows-upgrade because I was having the same issue described in issue #10

I then ran it (on Windows 8.1 pro) and got this error message:

PS C:\windows\system32> npm-windows-upgrade
npm-windows-upgrade 0.2.3
? This tool will upgrade npm. Do you want to continue? Yes
? Which version do you want to install? 2.12.1
Upgrading.. \

You wanted to install npm 2.12.1, but the installed version is2.11.2.
Please consider reporting your trouble to http://aka.ms/npm-issues.
Here is the output from the upgrader script:
[ '\r\n',
  '\r\n',
  '    Directory: C:\\Users\\Warren\\AppData\\Local\\Temp\r\n',
  '\r\n',
  '\r\n',
  'Mode                LastWriteTime     Length Name
  \r\n',
  '----                -------------     ------ ----
  \r\n',
  'd----          7/7/2015   1:58 PM            npm_upgrade
  \r\n',
  '[email protected] node_modules\\npm\n',
  'All done!\r\n',
  '\r\n',
  '\r\n' ] []

But despite the error message, it looks like the upgrade happened:

PS C:\windows\system32> npm list -g --depth=0
C:\Users\Warren\AppData\Roaming\npm
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

I am new to node and npm so could be just something weird I did to my environment while learning and experimenting but thought I would report it.

npm path problem?

I install npm-windows-upgrade,but when i use it to update my npm,have the problems:
npm-windows-upgrade 0.2.6
? This tool will upgrade npm. Do you want to continu
Scripts cannot be executed on this system.
To fix this issue, please run the command below as A
Set-ExecutionPolicy Unrestricted -Scope CurrentUser

cant upgrade from 2.11.2 to 3.1.0(beta)

Hi when i tried to upgrade to beta 3.1.0 version from 2.11.2, i am getting the following error. This is from windows 7.

C:\Windows\system32> npm-windows-upgrade
npm-windows-upgrade 0.2.0
? This tool will upgrade npm. Do you want to continue? Yes
? Which version do you want to install? 3.1.0
Upgrading.. -Error:  Write-Debug : A positional parameter cannot be found that accepts argument '+'.

Error:  At C:\Users\Ram\AppData\Roaming\npm\node_modules\npm-windows-upgrade\powershell\upgrade-npm.ps1:64 char:12
+ Write-Debug <<<<  "Assuming npm in " + $NpmPath
    + CategoryInfo          : InvalidArgument: (:) [Write-Debug], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.WriteDebugCommand


Upgrading.. \

You wanted to install npm 3.1.0, but the installed version is2.11.2.
Please consider reporting your trouble to http://aka.ms/npm-issues.
Here is the output from the upgrader script:
[] [ 'Write-Debug : A positional parameter cannot be found that accepts argument \'+\'.\r\n',
  'At C:\\Users\\Ram\\AppData\\Roaming\\npm\\node_modules\\npm-windows-upgrade\\powershell\\upgrade-npm.ps1:64 char:1
2\r\n+ Write-Debug <<<<  "Assuming npm in " + $NpmPath\r\n    + CategoryInfo          : InvalidArgument: (:) [Write-Debu
g], ParentContainsErrorRecordException\r\n    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell
.Commands.WriteDebugCommand\r\n \r\n' ]�

Upgrade AppData\Roaming\npm

I can only find reference to the npm install in ProgramFiles, I didn't see a reference to $env:APPDATA

I haven't spent much time looking at how the script works, but can it upgrade npm installs in AppData\Roaming\npm too? I noticed the npm documentation references this tool but there's no mention to dealing with AppData installs

Cannot read property 'indexOf' of undefined

npm-windows-upgrade
npm-upgrade-windows 0.1.5
? This tool will upgrade npm. Do you want to continue? Yes
? Which version do you want to install? 2.12.1
Upgrading.. -

npm-windows-upgrade\bin\npm-windows-upgrade:65
        } else if (output[output.length].indexOf('All done!') > -1) {
                                        ^
TypeError: Cannot read property 'indexOf' of undefined
    at C:\Users\User\AppData\Roaming\npm\node_modules\npm-windows-upgrade\bin\npm-windows-upgrade:65:41
    at ChildProcess.<anonymous> (C:\Users\User\AppData\Roaming\npm\node_modules\npm-windows-upgrade\bin\npm-windows-upgrade:29:9)
    at ChildProcess.emit (events.js:110:17)
    at Process.ChildProcess._handle.onexit (child_process.js:1074:12)

I get this error after the elevated power-shell window is spawned. The upgrade finished successfully though and I confirmed it with npm version

Upgrade fails with Node.js 5.4.1 and npm 3.5.4

Clean install of Node.js 5.4.1, attempting to upgrade npm yields the following:

C:\Windows\system32> npm-windows-upgrade
npm-windows-upgrade 1.2.0
? This tool will upgrade npm. Do you want to continue? Yes
? Which version do you want to install? 3.5.4
Upgrading... /Error:  npm
Error:
Error:  WARN ENOENT ENOENT: no such file or directory, open 'C:\Program Files\nodejs\package.json'

Error:  npm
Error:   WARN EPACKAGEJSON nodejs No description

Error:  npm
Error:  WARN EPACKAGEJSON nodejs No repository field.

Error:  npm WARN
Error:   EPACKAGEJSON nodejs No README data

Error:  npm WARN
Error:   EPACKAGEJSON nodejs No license field.

Error:  npm
Error:   WARN EBUNDLEOVERRIDE Replacing bundled node_modules\npm\node_modules\init-package-json with new installed versi
on

Error:  npm
Error:  WARN EBUNDLEOVERRIDE Replacing bundled node_modules\npm\node_modules\node-gyp with new installed version

Error:  npm
Error:  WARN EBUNDLEOVERRIDE Replacing bundled node_modules\npm\node_modules\npm-install-checks with new installed versi
on

Error:  npm
Error:   WARN EBUNDLEOVERRIDE Replacing bundled node_modules\npm\node_modules\npmlog with new installed version

Upgrading... -Error:  npm WARN EBUNDLEOVERRIDE Replacing bundled node_modules\npm\node_modules\read-package-json with ne
w installed version



We encountered an error during installation.
Please consider reporting your trouble to http://aka.ms/npm-issues.
Here is the error:

Could not determine npm version.

After the install failed, it completely broke npm and required me to run the Node.js installer to repair the installation. That fixed npm and allowed the script to work the 2nd attempt. But this issue happened on a fresh install of the latest Node.js.

Error: WARN ENOENT ENOENT: no such file or directory

Hi, my system is windows 10. I followed the instructions, and this is what comes out:

C:\WINDOWS\system32> npm-windows-upgrade
npm-windows-upgrade 0.5.1
? This tool will upgrade npm. Do you want to continue? (Y/n) Y
? This tool will upgrade npm. Do you want to continue? Yes
? Which version do you want to install? 3.3.12
Upgrading... \Error: npm
Error: WARN ENOENT ENOENT: no such file or directory, open 'C:\Program Files\nodejs\package.json'

Error: npm
Error: WARN EPACKAGEJSON nodejs No description

Error: npm
Error: WARN EPACKAGEJSON nodejs No repository field.

Error: npm WARN EPACKAGEJSON nodejs No README data

Error: npm
Error: WARN EPACKAGEJSON nodejs No license field.

Upgrading... |

Any idea why it's asking for the package.json? There's no such file in the location it's looking for.

SyntaxError: Unexpected token ♀

Getting this error when trying to run

npm-windows-upgrade 0.2.6
? This tool will upgrade npm. Do you want to continue? Yes
undefined:1
♀
^
SyntaxError: Unexpected token ♀
    at Object.parse (native)
    at C:\...\AppData\Roaming\npm\node_modules\npm-windows-upgrade\bin\npm-windows-upgrade:72:17
    at ChildProcess.exithandler (child_process.js:187:7)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:764:16)
    at Socket.<anonymous> (internal/child_process.js:319:11)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at Pipe._onclose (net.js:467:12)

Windows 8.1 PowerShell version 4

npm-windows-upgrade command not found

I have the default installation of Node.js for Windows (node-v0.12.7-x86.msi). After following the instructions on https://www.npmjs.com/package/npm-windows-upgrade and executing npm-windows-upgrade in the PowerShell console I got the following error:

npm-windows-upgrade : The term 'npm-windows-upgrade' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or   
if a path was included, verify that the path is correct and try again.                                                                                                           
At line:1 char:1                                                                                                                                                                 
+ npm-windows-upgrade                                                                                                                                                            
+ ~~~~~~~~~~~~~~~~~~~                                                                                                                                                            
    + CategoryInfo          : ObjectNotFound: (npm-windows-upgrade:String) [], CommandNotFoundException                                                                          
    + FullyQualifiedErrorId : CommandNotFoundException

Script execution policies interfere...

So when I first tried this (on win 7) I got:

Error: (x86)\nodejs\node_modules\npm-windows-upgrade\powershell\upgrade-npm.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.

Now, it was easy enough to work around this with:

Set-ExecutionPolicy Unrestricted -Scope CurrentUser

But it seems like this should be documented or tested for or something?

'Could not find installation location'

Here is the error:

[ 'Could not find installation location (assumed in C:\\Program Files (x86)\\nodejs) - aborting upgrade\r\n' ] []

By default nodejs installed at C:\\nodejs for me so I would assume there is some way to configure npm-windows-upgrade to look in another location? Is there, maybe, a script parameter to pass in representing the installed location of nodejs?

Thanks

npm install require admin.

node js installed on program files. and therefore npm is. older node did roaming. but after using this module it turned out the the roaming does not exist. and npm is tring to write to program files. which fails. any idea how to over come this issue? thanks!!

Global packages installed incorrectly due to missing npmrc file

This installer replaces node correctly however it does not generate the npmrc file. Without this file, npm requires admin rights to install global packages into nodejs\node_modules.

The nodejs.org 4.x and new 5.0 (which has [email protected]) installs global packages into %appdata%\npm.

It does this with the npmrc file which would be in nodejs/node_modules/npm/npmrc.

npmrc contents

prefix=${APPDATA}\npm

Edit:

It looks like you are copying the npmrc file to temp and copying it back after install, but this is not working because the filename is incorrect. It's npmrc not .npmrc, not sure if this changed in 3.x but in 3.x it's npmrc

Cannot find module in folder that was just removed?!

First, my working directory was C:\Program Files\nodejs\node_modules\npm because I was troubleshooting and I was getting errors like EBUSY: resource busy or locked, rmdir 'C:\Program Files\nodejs\node_modules\npm'. I finally realized what was going on and moved up a couple directoryies to nodejs so it was able to rmdir npm and node_modules, but then I got:

Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js' which makes perfect sense given that it was just removed.

Now my system npm folder is gone and I'm in worse shape than I started so I'm going to try to reinstall from .MSI

Here's the full log of what happened:

C:\Program Files\nodejs\node_modules\npm>npm install -g npm-windows-upgrade
C:\Users\myusername\AppData\Roaming\npm\npm-windows-upgrade -> C:\Users\myusername\AppData\Roaming\npm\node_modules\npm-windows-upgrade\bin\npm-windows-upgrade
[email protected] C:\Users\myusername\AppData\Roaming\npm\node_modules\npm-windows-upgrade
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

C:\Program Files\nodejs\node_modules\npm>npm-windows-upgrade
npm-windows-upgrade 0.4.1
? This tool will upgrade npm. Do you want to continue? (Y/n) Y
? This tool will upgrade npm. Do you want to continue? Yes
? Which version do you want to install? 3.3.3
Upgrading.. |Error:  npm
Error:
Error:  ERR!
Error:   Windows_NT 10.0.10240

Error:  npm
Error:   ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\myusername\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "[email protected]"

Error:  npm
Error:   ERR! node v4.0.0

Error:  npm ERR! npm  v2.14.3

Error:  npm ERR!
Error:  path C:\Program Files\nodejs\node_modules\npm
npm ERR!
Upgrading.. /Error:   code EBUSY
npm ERR! errno -4082
npm ERR! syscall rmdir


Error:  npm ERR! EBUSY: resource busy or locked, rmdir 'C:\Program Files\nodejs\node_modules\npm'
npm ERR!
Error:
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

Upgrading.. \Error:  npm
Error:   ERR! error rolling back Error: EBUSY: resource busy or locked, rmdir 'C:\Program Files\nodejs\node_modules\npm'
npm ERR! error rolling back
Error:       at Error (native)
npm ERR! error rolling back  { [Error: EBUSY: resource busy or locked, rmdir 'C:\Program Files\nodejs\node_modules\npm']
npm ERR! error rolling back   errno: -4082,
npm ERR! error rolling back   code: 'EBUSY',
npm ERR!
Error:   error rolling back   syscall: 'rmdir',
npm ERR! error rolling back   path: 'C:\\Program Files\\nodejs\\node_modules\\npm' }

Error:

Error:  npm ERR! Please include the following file with any support request:
npm
Error:  ERR!     C:\Program Files\nodejs\npm-debug.log

Upgrading.. |

You wanted to install npm 3.3.3, but the installed version is2.14.3.
Please consider reporting your trouble to http://aka.ms/npm-issues.
Here is the output from the upgrader script:
[ '\r\n',
  '\r\n',
  '    Directory: C:\\TEMP\r\n',
  '\r\n',
  '\r\n',
  'Mode                LastWriteTime         Length Name                                                                                                                                                                                                                        \r\n',
  '----                -------------         ------ ----                                                                                                                                                                                                                        \r\n',
  'd-----       2015-09-17     12:15                npm_upgrade                                                                                                                                                                                                                 \r\n',
  'All done!\r\n',
  '\r\n',
  '\r\n' ] [ 'npm',
  ' ',
  'ERR!',
  ' Windows_NT 10.0.10240\n',
  'npm',
  ' ERR! argv "C:\\\\Program Files\\\\nodejs\\\\node.exe" "C:\\\\Users\\\\myusername\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\npm\\\\bin\\\\npm-cli.js" "install" "[email protected]"\n',
  'npm',
  ' ERR! node v4.0.0\n',
  'npm ERR! npm  v2.14.3\n',
  'npm ERR! ',
  'path C:\\Program Files\\nodejs\\node_modules\\npm\nnpm ERR!',
  ' code EBUSY\nnpm ERR! errno -4082\nnpm ERR! syscall rmdir\n\n',
  'npm ERR! EBUSY: resource busy or locked, rmdir \'C:\\Program Files\\nodejs\\node_modules\\npm\'\nnpm ERR!',
  ' \nnpm ERR! If you need help, you may report this error at:\nnpm ERR!     <https://github.com/npm/npm/issues>\n',
  'npm',
  ' ERR! error rolling back Error: EBUSY: resource busy or locked, rmdir \'C:\\Program Files\\nodejs\\node_modules\\npm\'\nnpm ERR! error rolling back',
  '     at Error (native)\nnpm ERR! error rolling back  { [Error: EBUSY: resource busy or locked, rmdir \'C:\\Program Files\\nodejs\\node_modules\\npm\']\nnpm ERR! error rolling back   errno: -4082,\nnpm ERR! error rolling back   code: \'EBUSY\',\nnpm ERR!',
  ' error rolling back   syscall: \'rmdir\',\nnpm ERR! error rolling back   path: \'C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\' }\n',
  '\n',
  'npm ERR! Please include the following file with any support request:\nnpm ',
  'ERR!     C:\\Program Files\\nodejs\\npm-debug.log\n' ]

C:\Program Files\nodejs\node_modules\npm>node -v
v4.0.0

C:\Program Files\nodejs\node_modules\npm>npm-windows-upgrade
npm-windows-upgrade 0.4.1
? This tool will upgrade npm. Do you want to continue? (Y/n)
? This tool will upgrade npm. Do you want to continue? Yes
? Which version do you want to install? 3.3.3
Upgrading.. -Error:  npm
Error:
Error:  ERR!
Error:   Windows_NT 10.0.10240

Error:  npm
Error:   ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\myusername\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "[email protected]"

Error:  npm
Error:   ERR! node v4.0.0
npm ERR! npm  v2.14.3
npm ERR! path C:\Program Files\nodejs\node_modules\npm

Error:  npm ERR! code EBUSY
npm ERR! errno -4082
npm ERR! syscall rmdir


Error:  npm ERR! EBUSY: resource busy or locked, rmdir 'C:\Program Files\nodejs\node_modules\npm'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

Upgrading.. |Error:  npm
Error:   ERR! error rolling back Error: EBUSY: resource busy or locked, rmdir 'C:\Program Files\nodejs\node_modules\npm'
npm ERR! error rolling back     at Error (native)
npm ERR! error rolling back  { [Error: EBUSY: resource busy or locked, rmdir 'C:\Program Files\nodejs\node_modules\npm']
npm
Error:   ERR! error rolling back   errno: -4082,
npm ERR! error rolling back   code: 'EBUSY',
npm ERR! error rolling back   syscall: 'rmdir',
npm ERR! error rolling back   path: 'C:\\Program Files\\nodejs\\node_modules\\npm' }

Error:

Error:  npm ERR! Please include the following file with any support request:
npm ERR!     C:\Program Files\nodejs\npm-debug.log

Upgrading.. /

You wanted to install npm 3.3.3, but the installed version is2.14.3.
Please consider reporting your trouble to http://aka.ms/npm-issues.
Here is the output from the upgrader script:
[ 'All done!\r\n' ] [ 'npm',
  ' ',
  'ERR!',
  ' Windows_NT 10.0.10240\n',
  'npm',
  ' ERR! argv "C:\\\\Program Files\\\\nodejs\\\\node.exe" "C:\\\\Users\\\\myusername\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\npm\\\\bin\\\\npm-cli.js" "install" "[email protected]"\n',
  'npm',
  ' ERR! node v4.0.0\nnpm ERR! npm  v2.14.3\nnpm ERR! path C:\\Program Files\\nodejs\\node_modules\\npm\n',
  'npm ERR! code EBUSY\nnpm ERR! errno -4082\nnpm ERR! syscall rmdir\n\n',
  'npm ERR! EBUSY: resource busy or locked, rmdir \'C:\\Program Files\\nodejs\\node_modules\\npm\'\nnpm ERR! \nnpm ERR! If you need help, you may report this error at:\nnpm ERR!     <https://github.com/npm/npm/issues>\n',
  'npm',
  ' ERR! error rolling back Error: EBUSY: resource busy or locked, rmdir \'C:\\Program Files\\nodejs\\node_modules\\npm\'\nnpm ERR! error rolling back     at Error (native)\nnpm ERR! error rolling back  { [Error: EBUSY: resource busy or locked, rmdir \'C:\\Program Files\\nodejs\\node_modules\\npm\']\nnpm',
  ' ERR! error rolling back   errno: -4082,\nnpm ERR! error rolling back   code: \'EBUSY\',\nnpm ERR! error rolling back   syscall: \'rmdir\',\nnpm ERR! error rolling back   path: \'C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\' }\n',
  '\n',
  'npm ERR! Please include the following file with any support request:\nnpm ERR!     C:\\Program Files\\nodejs\\npm-debug.log\n' ]

C:\Program Files\nodejs\node_modules\npm>cd ..

C:\Program Files\nodejs\node_modules>npm-windows-upgrade
npm-windows-upgrade 0.4.1
? This tool will upgrade npm. Do you want to continue? (Y/n) y
? This tool will upgrade npm. Do you want to continue? Yes
We could not show latest available versions. Try running this script again with the version you want to install (npm-windows-upgrade --version:3.0.0

C:\Program Files\nodejs\node_modules>npm-windows-upgrade --version:2.14.3
npm-windows-upgrade 0.4.1
? This tool will upgrade npm. Do you want to continue? (Y/n) Y
? This tool will upgrade npm. Do you want to continue? Yes
Upgrading.. \Error:  module.js:338
    throw err;
    ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:286:25)
    at Function.Module.runMain (module.js:475:10)
    at startup (node.js:117:18)
    at node.js:951:3

Upgrading.. /Error:  module.js:338
    throw err;
    ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:286:25)
    at Function.Module.runMain (module.js:475:10)
    at startup (node.js:117:18)
    at node.js:951:3

Upgrading.. -

Could not determine npm version.
You wanted to install npm 2.14.3, but the installed version isnull.
Please consider reporting your trouble to http://aka.ms/npm-issues.
Here is the output from the upgrader script:
[ 'All done!\r\n' ] [ 'module.js:338\r\n    throw err;\r\n    ^\r\n\r\nError: Cannot find module \'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js\'\r\n    at Function.Module._resolveFilename (module.js:336:15)\r\n    at Function.Module._load (module.js:286:25)\r\n    at Function.Module.runMain (module.js:475:10)\r\n    at startup (node.js:117:18)\r\n    at node.js:951:3\r\n',
  'module.js:338\r\n    throw err;\r\n    ^\r\n\r\nError: Cannot find module \'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js\'\r\n    at Function.Module._resolveFilename (module.js:336:15)\r\n    at Function.Module._load (module.js:286:25)\r\n    at Function.Module.runMain (module.js:475:10)\r\n    at startup (node.js:117:18)\r\n    at node.js:951:3\r\n' ]

C:\Program Files\nodejs\node_modules>npm-windows-upgrade --version:2.14.3
npm-windows-upgrade 0.4.1
? This tool will upgrade npm. Do you want to continue? (Y/n) y
? This tool will upgrade npm. Do you want to continue? Yes
Upgrading.. -Error:  npm
Error:   ERR! Windows_NT 10.0.10240

Error:  npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\myusername\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "[email protected]"
npm ERR!
Error:   node v4.0.0
npm ERR! npm  v2.14.3
npm ERR! path C:\Program Files\nodejs\node_modules
npm ERR! code EBUSY
npm ERR! errno -4082
npm ERR! syscall rmdir

npm ERR! EBUSY: resource busy or locked, rmdir 'C:\Program Files\nodejs\node_modules'
npm
Error:  ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

Error:

Error:  npm ERR! Please include the following file with any support request:
npm ERR!     C:\Program Files\nodejs\npm-debug.log

Upgrading.. \

Could not determine npm version.
You wanted to install npm 2.14.3, but the installed version isnull.
Please consider reporting your trouble to http://aka.ms/npm-issues.
Here is the output from the upgrader script:
[ 'All done!\r\n' ] [ 'npm',
  ' ERR! Windows_NT 10.0.10240\n',
  'npm ERR! argv "C:\\\\Program Files\\\\nodejs\\\\node.exe" "C:\\\\Users\\\\myusername\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\npm\\\\bin\\\\npm-cli.js" "install" "[email protected]"\nnpm ERR!',
  ' node v4.0.0\nnpm ERR! npm  v2.14.3\nnpm ERR! path C:\\Program Files\\nodejs\\node_modules\nnpm ERR! code EBUSY\nnpm ERR! errno -4082\nnpm ERR! syscall rmdir\n\nnpm ERR! EBUSY: resource busy or locked, rmdir \'C:\\Program Files\\nodejs\\node_modules\'\nnpm ',
  'ERR! \nnpm ERR! If you need help, you may report this error at:\nnpm ERR!     <https://github.com/npm/npm/issues>\n',
  '\n',
  'npm ERR! Please include the following file with any support request:\nnpm ERR!     C:\\Program Files\\nodejs\\npm-debug.log\n' ]

C:\Program Files\nodejs\node_modules>cd ..

C:\Program Files\nodejs>npm-windows-upgrade --version:2.14.3
npm-windows-upgrade 0.4.1
? This tool will upgrade npm. Do you want to continue? (Y/n)
? This tool will upgrade npm. Do you want to continue? Yes
Upgrading.. \Error:  module.js:338
    throw err;
    ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:286:25)
    at Function.Module.runMain (module.js:475:10)
    at startup (node.js:117:18)
    at node.js:951:3

Upgrading.. -Error:  module.js:338
    throw err;
    ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:286:25)
    at Function.Module.runMain (module.js:475:10)
    at startup (node.js:117:18)
    at node.js:951:3

Upgrading.. \

Could not determine npm version.
You wanted to install npm 2.14.3, but the installed version isnull.
Please consider reporting your trouble to http://aka.ms/npm-issues.
Here is the output from the upgrader script:
[ 'All done!\r\n' ] [ 'module.js:338\r\n    throw err;\r\n    ^\r\n\r\nError: Cannot find module \'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js\'\r\n    at Function.Module._resolveFilename (module.js:336:15)\r\n    at Function.Module._load (module.js:286:25)\r\n    at Function.Module.runMain (module.js:475:10)\r\n    at startup (node.js:117:18)\r\n    at node.js:951:3\r\n',
  'module.js:338\r\n    throw err;\r\n    ^\r\n\r\nError: Cannot find module \'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js\'\r\n    at Function.Module._resolveFilename (module.js:336:15)\r\n    at Function.Module._load (module.js:286:25)\r\n    at Function.Module.runMain (module.js:475:10)\r\n    at startup (node.js:117:18)\r\n    at node.js:951:3\r\n' ]

C:\Program Files\nodejs>

ExecutionPolicy script is not recognized as an internal or external command

Hi guys I execute the script(Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force) from folder where you tool is located(disk D/npm-windows-upgrade-master) in cmd(that I run as admin) and see next message:
'Set-ExecutionPolicy' is not recognized as an internal or external command,
operable program or batch file.

Windows 7 64 bit

Thank you very much

A issue a little surprising to thank you for that complete and efficient script.

Thou hast taken away pain.

Doesn't seem to work behind a corporate proxy?

I followed the installation instructions on the README.
Then, when I try to run the tool, I get an error:

λ npm-windows-upgrade                                                                       
npm-windows-upgrade 0.3.2                                                                   
? This tool will upgrade npm. Do you want to continue? Yes                                  
R:\java\tools\npm\node_modules\npm-windows-upgrade\bin\npm-windows-upgrade:294              
                return console.err(chalk.bold.red('We have trouble connecting               
                               ^                                                            
TypeError: undefined is not a function                                                      
    at R:\java\tools\npm\node_modules\npm-windows-upgrade\bin\npm-windows-upgrade:294:32    
    at R:\java\tools\npm\node_modules\npm-windows-upgrade\bin\npm-windows-upgrade:55:13     
    at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:81:16)                        
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:94:17)                           

There seems to be two problems.

  1. Re: the "We have trouble connecting to the Internet..." error message seems to indicate that npm-windows-upgrade seems to have trouble connecting to the Internet and I'm not sure why.
    I'm in a corporate environment behind a proxy but npm is configured correctly to use the proxy and it has no problem doing downloading packages from npmjs.org example.
    Maybe this is happening because I'm behind a corporate proxy and the script does not correctly pick up the proxy settings like npm does?
  2. npm-windows-upgrade then crashes trying to report the above issue.

I'm using node v0.12.7 and npm 2.11.3. behing a proxy

npm 3.1.2 and global packages?

I did a clean install of Node 12.7. I installed this and updated to npm 3.1.2. I installed some global packages, which installed in Program Files\NPM.

The global packages used to be installed in %appdata%.

%localappadata% is a better alternative.

Is this an issue with this script or just NPM 3.1.2. I'm asking here because I didn't see anything in the changelog about it for npm.

Error using npm-windows-upgrade

PS C:\WINDOWS\system32> npm-windows-upgrade
npm-windows-upgrade 0.4.0
? This tool will upgrade npm. Do you want to continue? Yes
? Which version do you want to install? 3.3.0
Upgrading.. |Error: npm
Error:
Error: http GET https://registry.npmjs.org/npm/3.3.0

Upgrading.. |Error: npm
Error:
Error: http
Error: 200 https://registry.npmjs.org/npm/3.3.0

Upgrading.. /Error: npm
Error:
Error: http
Error: GET https://registry.npmjs.org/npm/-/npm-3.3.0.tgz

Upgrading.. -Error: npm
Error:
Error: http
Error: 200 https://registry.npmjs.org/npm/-/npm-3.3.0.tgz

Upgrading.. -

Could not determine npm version.
You wanted to install npm 3.3.0, but the installed version isnull.
Please consider reporting your trouble to http://aka.ms/npm-issues.
Here is the output from the upgrader script:
[ '\r\n',
'\r\n',
' Directorio: C:\Users\svidal\AppData\Local\Temp\r\n',
'\r\n\r\n',
'Mode LastWriteTime Length Name
\r\n',
'---- ------------- ------ ----
\r\n',
'd---- 20/08/2015 10:11 npm_upgrade
\r\n',
'[email protected] node_modules\npm\n',
'All done!\r\n',
'\r\n',
'\r\n' ] [ 'npm',
' ',
'http GET https://registry.npmjs.org/npm/3.3.0\n',
'npm',
' ',
'http ',
'200 https://registry.npmjs.org/npm/3.3.0\n',
'npm',
' ',
'http',
' GET https://registry.npmjs.org/npm/-/npm-3.3.0.tgz\n',
'npm',
' ',
'http',
' 200 https://registry.npmjs.org/npm/-/npm-3.3.0.tgz\n' ]
PS C:\WINDOWS\system32> npm -v

module.js:340
throw err;
^
Error: Cannot find module 'are-we-there-yet'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\npmlog\log.js:2:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
PS C:\WINDOWS\system32> npm-windows-upgrade
npm-windows-upgrade 0.4.0
? This tool will upgrade npm. Do you want to continue? Yes
We could not show latest available versions. Try running this script again with the version you want to install (npm-win
dows-upgrade --version:3.0.0
PS C:\WINDOWS\system32> npm-windows-upgrade --version:3.1.0
npm-windows-upgrade 0.4.0
? This tool will upgrade npm. Do you want to continue? Yes
Upgrading.. |Error:
module.js:340
throw err;
^
Error: Cannot find module 'are-we-there-yet'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\npmlog\log.js:2:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)

Upgrading.. /

Could not determine npm version.
You wanted to install npm 3.1.0, but the installed version isnull.
Please consider reporting your trouble to http://aka.ms/npm-issues.
Here is the output from the upgrader script:
[ 'All done!\r\n' ] [ '\r\nmodule.js:340\r\n throw err;\r\n ^\r\nError: Cannot find module 'are-we-there-ye
t'\r\n at Function.Module._resolveFilename (module.js:338:15)\r\n at Function.Module._load (module.js:280:25)\r\n
at Module.require (module.js:364:17)\r\n at require (module.js:380:17)\r\n at Object. (C:\Program
Files (x86)\nodejs\node_modules\npm\node_modules\npmlog\log.js:2:16)\r\n at Module._compile (module.js:456:26)
r\n at Object.Module._extensions..js (module.js:474:10)\r\n at Module.load (module.js:356:32)\r\n at Function.M
odule._load (module.js:312:12)\r\n at Module.require (module.js:364:17)\r\n' ]

Windows 10 (build 10163) required the "-Force" with the Set-ExecutionPolicy command to work

I run Windows 10 (build 10163). The command "Set-ExecutionPolicy Unrestricted -Scope CurrentUser" did not work for the "npm-windows-upgrade" command.


Windows PowerShell
Copyright (C) 2015 Microsoft Corporation. All rights reserved.

PS C:\WINDOWS\system32> Set-ExecutionPolicy Unrestricted -Scope CurrentUser
PS C:\WINDOWS\system32> npm-windows-upgrade
npm-windows-upgrade 0.2.6
? This tool will upgrade npm. Do you want to continue? Yes
Scripts cannot be executed on this system. <<<<<< ERROR
To fix this issue, please run the command below as Administrator and try again:

Set-ExecutionPolicy Unrestricted -Scope CurrentUser

Adding the "-Force" parameter fix the problem.
The result is below.


PS C:\Program Files (x86)\nodejs> Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
PS C:\Program Files (x86)\nodejs> npm-windows-upgrade
npm-windows-upgrade 0.2.6
? This tool will upgrade npm. Do you want to continue? Yes
? Which version do you want to install? 3.1.3
Upgrading.. -

Upgrade finished. Your new npm version is 3.1.3. Have a nice day!
PS C:\Program Files (x86)\nodejs>

Cannot bind argument to parameter 'Path' because it is null.

I'm getting this error in upgrade-npm.ps1

Cannot bind argument to parameter 'Path' because it is null.
 + CategoryInfo          : InvalidData: (:) [upgrade-npm.ps1], ParameterBindingValidationException
 + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,upgrade-npm.ps1

ProgramFiles expression

This line should have an expression - ${env:ProgramFiles(x86)}

Upgrading.. -Error:  At C:\Users\jonno\AppData\Roaming\npm\node_modules\npm-windows-upgrade\powershell\upgrade-npm.ps1:5
8 char:33

Error:  +     $npmPath = $env:ProgramFiles(x86) + "\nodejs\node_modules\npm"
+                                 ~
Unexpected token '(' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : UnexpectedToken

EPERM issue after using npm-windows-upgrade

Hey,
First of all thanks a lot for this great tool! I've managed to update my npm to newest version without any problem. Although after this process I can't install modules without running console as administrator. Currently I am using ConEmu with GitBash and after running for example npm install -g ember-cli I get an error:

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "ember-cli"
npm ERR! node v4.0.0
npm ERR! npm  v3.3.2
npm ERR! path c:\Program Files\nodejs\node_modules\.staging
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall mkdir

npm ERR! Error: EPERM: operation not permitted, mkdir 'c:\Program Files\nodejs\node_modules\.staging'
npm ERR!     at Error (native)
npm ERR!  { [Error: EPERM: operation not permitted, mkdir 'c:\Program Files\nodejs\node_modules\.staging']
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: 'c:\\Program Files\\nodejs\\node_modules\\.staging' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\marw\Workspace\npm-debug.log
/c/Program Files/nodejs/npm: line 27:  6072 Signal 112              (core dumped) "$NODE_EXE" "$NPM_CLI_JS" "$@"

You wanted to install npm 3.2.0, but the installed version is1.4.9. issue

You wanted to install npm 3.2.0, but the installed version is1.4.9.
Please consider reporting your trouble to http://aka.ms/npm-issues.
Here is the output from the upgrader script:
[ '\r\n',
  '\r\n',
  '    Directory: C:\\Users\\<username>\\AppData\\Local\\Temp\r\n',
  '\r\n',
  '\r\n',
  'Mode                LastWriteTime     Length Name
  \r\n',
  '----                -------------     ------ ----
  \r\n',
  'd----         27-Jul-15   5:47 PM            npm_upgrade
  \r\n',
  '[email protected] node_modules\\npm\n',
  'All done!\r\n',
  '\r\n',
  '\r\n' ] []

npm WARN EPACKAGEJSON

I am receiving the following error when executing npm-windows-upgrade (sorry for the horrible formatting, just dumping a copy/paste from my cmd window):

You wanted to install npm 3.1.3, but the installed version is2.11.3.
Please consider reporting your trouble to http://aka.ms/npm-issues.
Here is the output from the upgrader script:
[ 'C:\\Users\\Dave\\AppData\\Roaming\\npm\\npm -> C:\\Users\\Dave\\AppData\\Roam
ing\\npm\\node_modules\\npm\\bin\\npm-cli.js\n',
  'C:\\Users\\Dave\\AppData\\Roaming\\npm\n└── [email protected] \n\n',
  'All done!\r\n' ] [ 'npm',
  ' WARN EPACKAGEJSON C:\\Users\\Dave\\AppData\\Roaming\\npm No description\n',
  'npm ',
  'WARN EPACKAGEJSON C:\\Users\\Dave\\AppData\\Roaming\\npm No repository field.
\n',
  'npm WARN EPACKAGEJSON C:\\Users\\Dave\\AppData\\Roaming\\npm No README data\n
',
  'npm WARN EPACKAGEJSON C:\\Users\\Dave\\AppData\\Roaming\\npm No license field
.\n' ]

Executing npm -v returns 2.11.3 at this point.

I ended up executing npm install -g [email protected] and copying the contents of the roaming npm folder to %programfiles%\nodejs\node_modules\npm and ran npm-windows-upgrade again for kicks and giggles, and it reported the same warnings, but then counted the upgrade as a success.

Here's my specs:
Node: v0.12.7
Npm: v2.11.3
Windows: 8 x64 Professional
(no IO.js is currently installed, but it was at one point)

Unhandled 'error' when trying to upgrade

Tried to upgrade and immediately got error:

npm_upgrade_error

Ran the package in the GitHub shell, with and without the suggested SetExecutionPolicy (as per the readme.) Also tried to run in the command prompt as administrator and got an error when attempting to use SetExecutionPolicy.

Error when I launch the commande

Hi,

When I launch the basic commande : npm-windows-updrade and say Yes I have this error :

undefined:1

^
SyntaxError: Unexpected token ♀
at Object.parse (native)
at C:\Users\a.huc\AppData\Roaming\npm\node_modules\npm-windows-upgrade\bin\npm-windows-upgrade:79:17
at ChildProcess.exithandler (child_process.js:742:7)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

How can I correct it ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.