Skip to content

[BUG] npm install truncates paths at # #6809

Closed
@hseg

Description

@hseg

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 install appears to truncate its arguments after the first # character, thus not finding the correct file when the path contains a #.

Expected Behavior

The only characters that should cause trouble in unix systems in paths are control characters (in particular, NUL) and forward/backward slashes (as path components). Under windows, further restrictions on valid paths exist, but they shouldn't prevent npm from finding files on valid paths.

Steps To Reproduce

Encountered while building the package https://aur.archlinux.org/packages/nodejs-nativefier in /home/gesh/aur/9#deps/whatsapp-nativifier/nodejs-nativefier, problem vanished when building in /home/gesh/aur/whatsapp-nativifier/nodejs-nativefier.
Log attached

Context-agnostic instructions:

  • Download eg http://registry.npmjs.org/nativefier/-/nativefier-52.0.0.tgz to ~/0#broken/
  • npm install ~/0#broken/*.tgz
  • npm complains it can't find ~/0
  • However, mv ~/0#broken ~/fixed
  • npm install ~/fixed/*.tgz
  • Everything works fine

Environment

; "user" config from /home/gesh/.local/etc/npm/npmrc

cache = "/home/gesh/.local/var/cache/npm" 
init-module = "/home/gesh/.local/etc/npm/config/npm-init.js" 
prefix = "/home/gesh/.local" 

; "env" config from environment

userconfig = "/home/gesh/.local/etc/npm/npmrc" 

; node bin location = /usr/bin/node
; node version = v20.6.1
; npm local prefix = /home/gesh
; npm version = 10.1.0
; cwd = /home/gesh
; HOME = /home/gesh
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingPriority 2secondary priority issueRelease 10.xRelease 9.xwork is associated with a specific npm 9 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions