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

[BUG] npm.ps1 introduced two regressions #7462

Open
2 tasks done
liuxingbaoyu opened this issue May 2, 2024 · 0 comments
Open
2 tasks done

[BUG] npm.ps1 introduced two regressions #7462

liuxingbaoyu opened this issue May 2, 2024 · 0 comments
Assignees
Labels
Bug thing that needs fixing platform:windows is Windows-specific

Comments

@liuxingbaoyu
Copy link

liuxingbaoyu commented May 2, 2024

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

npm.ps1 introduced two regressions.

  1. There is an encoding error when the username is non-ascii
  2. When C:\Users\user\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js does not exist, it does not fall back to C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js. Fixed in latest
node:internal/modules/cjs/loader:1205
  throw err;
  ^

Error: Cannot find module 'C:\Users\娴佹槦鏆撮洦\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1202:15)
    at Module._load (node:internal/modules/cjs/loader:1027:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:187:14)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v22.0.0

When I added $OutputEncoding = [Console]::OutputEncoding = [Text.UTF8Encoding]::UTF8 to fix the encoding issue

PS F:\git\node-js-max_path-windows-bug> npm.ps1
node:internal/modules/cjs/loader:1205
  throw err;
  ^

Error: Cannot find module 'C:\Users\流星暴雨\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1202:15)
    at Module._load (node:internal/modules/cjs/loader:1027:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:187:14)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v22.0.0

Expected Behavior

suceess

Steps To Reproduce

  1. Run npm.ps1 on a Windows machine with a non-ascii username.
  2. See error...

Environment

  • npm: 10.5.1
  • Node.js: v22.0.0
  • OS Name: Windows 11
  • System Model Name:
  • npm config:
; "builtin" config from C:\Program Files\nodejs\node_modules\npm\npmrc

prefix = "C:\\Users\\流星暴雨\\AppData\\Roaming\\npm"

; "global" config from C:\Users\流星暴雨\AppData\Roaming\npm\etc\npmrc

python = "C:\\Python27\\python.exe"

; "user" config from C:\Users\流星暴雨\.npmrc

//registry.npmjs.org/:_authToken = (protected)
strict-ssl = false

; node bin location = C:\Program Files\nodejs\node.exe
; node version = v22.0.0
; npm local prefix = F:\git\node-js-max_path-windows-bug
; npm version = 10.5.1
; cwd = F:\git\node-js-max_path-windows-bug
; HOME = C:\Users\流星暴雨
; Run `npm config ls -l` to show all defaults.
@liuxingbaoyu liuxingbaoyu added Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x labels May 2, 2024
@liuxingbaoyu liuxingbaoyu changed the title [BUG] <title> [BUG] npm.ps1 introduced two regressions May 2, 2024
@lukekarrys lukekarrys added platform:windows is Windows-specific and removed Needs Triage needs review for next steps labels May 10, 2024
@lukekarrys lukekarrys self-assigned this May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing platform:windows is Windows-specific
Projects
None yet
Development

No branches or pull requests

2 participants