Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng update on windows fails when cli version wants to preinstall | loader.js | Cannot find module #18891

Open
florian-kittel opened this issue Sep 25, 2020 · 4 comments

Comments

@florian-kittel
Copy link

@florian-kittel florian-kittel commented Sep 25, 2020

🐞 Bug report

Command (mark with an x)

  • [ x ] update

Is this a regression?

Yes, the previous version in which this bug was not present was: 6, 7, partially in 8 (depend on the cli version)

Description

A user directory on windows is 'C:\Users\Firstname Lastname...' - what mean it includes a whitespace between the first and last name. When the given project has not the latest cli version installed, a temporary install happen of the lastes cli version to use it for ng update. Then the following error happen (I holde it generic by using "Firstname Lastname":

$ ng update
The installed local Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
Installing packages for tooling via npm.
Installed packages for tooling via npm.
internal/modules/cjs/loader.js:1083
  throw err;
  ^

Error: Cannot find module 'C:\Users\Firstname'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1080:15)
    at Function.Module._load (internal/modules/cjs/loader.js:923:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

🔬 Minimal Reproduction

Have a windows system where the user name uses a whitespace (like "Firstname Lastname" or "John Doe") and an Angular project that has not the latest cli installed. Run ng update.

🔥 Exception or Error


$ ng update
The installed local Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
Installing packages for tooling via npm.
Installed packages for tooling via npm.
internal/modules/cjs/loader.js:1083
  throw err;
  ^

Error: Cannot find module 'C:\Users\Firstname'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1080:15)
    at Function.Module._load (internal/modules/cjs/loader.js:923:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

🌍 Your Environment


Angular CLI: 10.1.1
Node: 14.8.0
OS: win32 x64

Angular: 10.1.1
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.1001.1
@angular-devkit/build-angular      0.1001.1
@angular-devkit/build-ng-packagr   0.1001.1
@angular-devkit/build-optimizer    0.1001.1
@angular-devkit/build-webpack      0.1001.1
@angular-devkit/core               10.1.1
@angular-devkit/schematics         10.1.1
@ngtools/webpack                   10.1.1
@schematics/angular                10.1.1
@schematics/update                 0.1001.1
ng-packagr                         10.1.0
rxjs                               6.6.3
typescript                         4.0.2
webpack                            4.44.1

Anything else relevant?
To use ng update it is possible to update the local pacakge to latest version by increasing it in package.json by hand and do an npm install. Then with the lastest version ng update always works. It is the problem with the mechanism to preinstall the lastes version on ng update command.

I also tried to route the global node_modules to a different folder. That works for all global packages, but not for that command. It will always use the users directory.

@alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 commented Sep 25, 2020

Related to #17870

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
@florian-kittel @alan-agius4 and others