Skip to content

ng update fails when windows username contains a space #16865

@simeyla

Description

@simeyla

🐞 bug report

Affected Package

ng update

Is this a regression?

Never seen before.

Good news

This appears to be fixed once updating to latest version - but since the error is observed when trying to do precisely that I thought the solution below may help others.

Description

My Windows user account contains a space, and specifically my temp directories are:

TEMP=C:\Users\Simon Weaver\AppData\Local\Temp
TMP=C:\Users\Simon Weaver\AppData\Local\Temp

When running ng update to update to Angular 9 I get the log below - due to the space.

Most notable line:
Could not install from "Weaver\AppData\Local\T...

🔬 Minimal Reproduction

I'm only able to provide the logging as follows:

PS S:\tfs\rr\Defender.NG> ng update --verbose
Locating potential npmrc files:
Trying 'C:\Program Files\nodejs\etc\npmrc'...not found.
Trying 'C:\Users\Simon Weaver\.npmrc'...not found.
Trying 'S:\tfs\.npmrc'...not found.
Trying 'S:\tfs\rr\.npmrc'...not found.
Trying 'S:\tfs\rr\Defender.NG\.npmrc'...not found.
The installed Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
Installing packages for tooling via npm.
An unhandled exception occurred: npm ERR! code ENOLOCAL
npm ERR! Could not install from "Weaver\AppData\Local\Temp\.ng-temp-packages-h9b5YS" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Simon Weaver\AppData\Roaming\npm-cache\_logs\2020-02-07T06_00_18_234Z-debug.log

So pretty obviously something somewhere is blowing up because of the space in my username.

🌍 Your Environment

This was discovered on 8.2.14 but not sure the CLI version at the time.
Also I'm not clear if this issue is already fixed.

Workaround

I just created a folder c:\temp\angulartemp and set the environmental variables

set tmp=c:\temp\angulartemp
set temp=c:\temp\angulartemp

I was then able to follow the install instructions for ng update and everything went great :-)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions