-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 releasework is associated with a specific npm 8 release
Description
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
When working inside path that includes hash character (#
), using npm link
causes to crash because it cuts the path at the hash. My guess it's because it handles it as URI, just with file://
schema, and even those have #
used as hash fragment.
Under Windows:
S:\#test>npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help init` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
package name: (#test) test-the-hash-for-npm-link
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to S:\#test\package.json:
{
"name": "test-the-hash-for-npm-link",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Is this OK? (yes)
S:\#test>ls
'ls' is not recognized as an internal or external command,
operable program or batch file.
S:\#test>dir
Volume in drive S has no label.
Volume Serial Number is 0E8F-6BAF
Directory of S:\#test
03.07.2022 17:47 <DIR> .
03.07.2022 17:47 <DIR> ..
03.07.2022 17:47 222 package.json
1 File(s) 222 bytes
2 Dir(s) 53 127 081 984 bytes free
S:\#test>code package.json
S:\#test>npm link
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path S:\/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'S:\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\PsychoX\AppData\Local\npm-cache\_logs\2022-07-03T15_49_16_433Z-debug-0.log
S:\#test>
The complete log of npm link
:
0 verbose cli C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
1 info using npm@8.13.2
2 info using node@v16.13.1
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:C:\Program Files\nvm\v16.13.1\node_modules\npm\npmrc Completed in 1ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:S:\#test\.npmrc Completed in 1ms
10 timing config:load:project Completed in 2ms
11 timing config:load:file:C:\Users\PsychoX\.npmrc Completed in 1ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:C:\Program Files\nodejs\etc\npmrc Completed in 1ms
14 timing config:load:global Completed in 1ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 11ms
19 timing npm:load:configload Completed in 12ms
20 timing npm:load:mkdirpcache Completed in 1ms
21 timing npm:load:mkdirplogs Completed in 1ms
22 verbose title npm link
23 verbose argv "link"
24 timing npm:load:setTitle Completed in 0ms
25 timing config:load:flatten Completed in 2ms
26 timing npm:load:display Completed in 4ms
27 verbose logfile logs-max:10 dir:C:\Users\PsychoX\AppData\Local\npm-cache\_logs
28 verbose logfile C:\Users\PsychoX\AppData\Local\npm-cache\_logs\2022-07-03T15_49_16_433Z-debug-0.log
29 timing npm:load:logFile Completed in 5ms
30 timing npm:load:timers Completed in 0ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm:load Completed in 24ms
33 timing arborist:ctor Completed in 1ms
34 silly logfile start cleaning logs, removing 1 files
35 silly logfile done cleaning log files
36 timing idealTree:init Completed in 6ms
37 timing idealTree Completed in 8ms
38 timing command:link Completed in 24ms
39 verbose stack Error: ENOENT: no such file or directory, open 'S:\package.json'
40 verbose cwd S:\#test
41 verbose Windows_NT 10.0.19043
42 verbose node v16.13.1
43 verbose npm v8.13.2
44 error code ENOENT
45 error syscall open
46 error path S:\/package.json
47 error errno -4058
48 error enoent ENOENT: no such file or directory, open 'S:\package.json'
49 error enoent This is related to npm not being able to find a file.
49 error enoent
50 verbose exit -4058
51 timing npm Completed in 142ms
52 verbose unfinished npm timer reify 1656863356547
53 verbose unfinished npm timer reify:loadTrees 1656863356558
54 verbose unfinished npm timer idealTree:userRequests 1656863356566
55 verbose code -4058
56 error A complete log of this run can be found in:
56 error C:\Users\PsychoX\AppData\Local\npm-cache\_logs\2022-07-03T15_49_16_433Z-debug-0.log
Expected Behavior
Expected behaviour would be npm link
just working as usual, creating link in global packages directory.
Steps To Reproduce
- Prepare empty folder in path (or name) including hash character (
#
). - Initialize package with
npm init
. - Try
npm link
(with admin privileges under Windows, as creating links sometimes requires those).
Environment
- npm:
8.13.2
- Node.js:
v16.13.1
- OS Name:
Microsoft Windows 10 Home 10.0.19043 N/A Build 19043
- System Model Name:
GS65 Stealth 8SE
- npm config:
; "user" config from C:\Users\PsychoX\.npmrc
//registry.npmjs.org/:_authToken = (protected)
prefix = "C:\\Program Files\\nodejs"
; node bin location = C:\Program Files\nodejs\node.exe
; node version = v16.13.1
; npm local prefix = D:\Projects\#gaming\StellarisCheats
; npm version = 8.13.2
; cwd = D:\Projects\#gaming\StellarisCheats
; HOME = C:\Users\PsychoX
; Run `npm config ls -l` to show all defaults.
Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 releasework is associated with a specific npm 8 release