felixrieseberg/npm-windows-upgrade

Unexpected Identifier in Upgrader.Js

rolfea opened this issue ยท 14 comments

Hello! Thank you for this tool.

When I install the tool from NPM following your instructions, then attempt to run it, I get the following error, thrown from upgrader.js:

C:\Users\...\AppData\Roaming\npm\node_modules\npm-windows-upgrade\src\upgrader.js:26
  async ensureInternet () {
        ^^^^^^^^^^^^^^

SyntaxError: Unexpected identifier
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\arolfe\AppData\Roaming\npm\node_modules\npm-windows-upgrade\bin\npm-windows-upgrade.js:8:16)

Current NPM version: 6.2.0
Current Node version: 6.11.3
Platform: Windows 10 Pro
Version 10.0.17134 Build 17134

I've tried uninstalling and reinstalling and also specifying a specific npm version (npm-windows-upgrade --npm-version 10.15.0) but get the same error.

When I run with -d flag to skip the internet check, the tool runs correctly and upgrades npm on my machine.

I'm also getting same above error while upgrading time, Is there any possible solutions to fix it.

@msankar1991 did you try running with the '-d' flag?
Try
'npm-windows-upgrade -d'

For me this worked because it skips the block of code throwing this error.

filol commented

@rolfea Your tips isn't working for me

image

@filol hey! I'm not the maintainer, but it might be easier to troubleshoot if you gave a few more details, like your current node and npm versions

filol commented

@rolfea Hey, yeah, I know, it's just to warn developers that putting the -d option doen't work for everyone. For my update problem I solved it by doing a full reinstallation. Thank you for trying to solve my problem :D

Same issue with me , just installed npm-windows-upgrade. Tried with the -d option too , not working.

@avithe1 what version of node are you coming from? it might be helpful to dump out a little more info, like node/npm versions, platform, etc.

Also had this issue

2D commented

+1
error npm

I apologize for not making this more obvious, but v6 of this tool requires at least Node 8. Versions for Node 6, 4, and older are available: https://github.com/felixrieseberg/npm-windows-upgrade/blob/master/README.md#older-nodejs-versions

I'm running node v6.9.5, & i still had this issue
I try all options, but not working for me
npm

For anyone else out there still experiencing this, my team encountered this error today.

It turned out the problem was that the version of npm installed (from node.js) was not compatible with the latest 'npm-windows-upgrade' that was present in the system. The solution was simply to install an older version of 'npm-windows-upgrade' prior to executing it.

e.g.
npm uninstall -g npm-windows-upgrade
npm install -g npm-windows-upgrade@4.0.1
npm-windows-upgrade

For anyone else out there still experiencing this, my team encountered this error today.

It turned out the problem was that the version of npm installed (from node.js) was not compatible with the latest 'npm-windows-upgrade' that was present in the system. The solution was simply to install an older version of 'npm-windows-upgrade' prior to executing it.

e.g.
npm uninstall -g npm-windows-upgrade
npm install -g npm-windows-upgrade@4.0.1
npm-windows-upgrade

I tried the above but used @5.0.0 and got the message that I needed to uninstall my version of node (older version) and install latest version to get updated node and npm.

This solved the problem. I ended up using nvm to install the latest LTS version of node and got the latest version of npm along with it. Then I used nvm to uninstall the older version of node.

Problem solved. You can actually migrate your packages from the older version of node to the latest version of node before deleting the old node, but I didn't end up doing that. I would rather start fresh and install all the latest packages any way.