feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
14.97k stars 742 forks source link

Issue creating a new project after changing NPM's folder routes #3404

Closed JustADataConstruct closed 5 months ago

JustADataConstruct commented 5 months ago

Hello! So, for storage-related reasons I have my Node / NPM installation configured to store thing on the E: partition instead of C:, and while I haven't had any related troubles with other packages so far, it seems to have broken something when trying to create a new Feathers project:

Steps to reproduce

1 - Install NodeJs. Use the npm config set --global to change the prefix (to E:\Dev\nodeprefix) and cache (to E:\Dev\nodecache) routes of NPM. 2- Try creating a new Feathers project with npm create feathers@latest <name>

Expected behavior

Project is created successfully.

Actual behavior

After running npm create feathers@latest <name>, the console throws an error and stops:

node:fs:581
  return binding.open(
                 ^

Error: ENOENT: no such file or directory, open 'E:\E:\Dev\nodecache\_npx\eb274edb682bcb28\node_modules\@feathersjs\generators\package.json'
    at Object.openSync (node:fs:581:18)
    at Object.readFileSync (node:fs:457:35)
    at file:///E:/Dev/nodecache/_npx/eb274edb682bcb28/node_modules/@feathersjs/generators/lib/commons.js:10:42
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async loadESM (node:internal/process/esm_loader:28:7)
    at async handleMainPromise (node:internal/modules/run_main:113:12) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'E:\\E:\\Dev\\nodecache\\_npx\\eb274edb682bcb28\\node_modules\\@feathersjs\\generators\\package.json'
}
Node.js v20.11.0
npm ERR! code 1
npm ERR! path E:\Dev\node_projects
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c create-feathers test

npm ERR! A complete log of this run can be found in: E:\Dev\nodecache\_logs\2024-01-24T18_33_45_100Z-debug-0.log

These are the contents of the log:

0 verbose cli E:\software\nodejs\node.exe E:\software\nodejs\node_modules\npm\bin\npm-cli.js
1 info using npm@10.2.4
2 info using node@v20.11.0
3 timing npm:load:whichnode Completed in 2ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:E:\software\nodejs\node_modules\npm\npmrc Completed in 3ms
6 timing config:load:builtin Completed in 3ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:E:\Dev\node_projects\.npmrc Completed in 1ms
10 timing config:load:project Completed in 2ms
11 timing config:load:file:C:\Users\PC\.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:C:\Users\PC\AppData\Roaming\npm\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:setEnvs Completed in 1ms
16 timing config:load Completed in 8ms
17 timing npm:load:configload Completed in 8ms
18 timing config:load:flatten Completed in 2ms
19 timing npm:load:mkdirpcache Completed in 0ms
20 timing npm:load:mkdirplogs Completed in 0ms
21 verbose title npm create feathers test
22 verbose argv "create" "feathers" "test"
23 timing npm:load:setTitle Completed in 1ms
24 timing npm:load:display Completed in 0ms
25 verbose logfile logs-max:10 dir:E:\software\nodecache\_logs\2024-01-24T18_33_45_100Z-
26 verbose logfile E:\software\nodecache\_logs\2024-01-24T18_33_45_100Z-debug-0.log
27 timing npm:load:logFile Completed in 7ms
28 timing npm:load:timers Completed in 0ms
29 timing npm:load:configScope Completed in 0ms
30 timing npm:load Completed in 39ms
31 silly logfile start cleaning logs, removing 4 files
32 timing arborist:ctor Completed in 0ms
33 silly logfile done cleaning log files
34 http fetch GET 200 https://registry.npmjs.org/create-feathers 911ms (cache revalidated)
35 timing arborist:ctor Completed in 1ms
36 timing arborist:ctor Completed in 0ms
37 timing command:create Completed in 1601ms
38 verbose stack Error: command failed
38 verbose stack     at ChildProcess.<anonymous> (E:\software\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:53:27)
38 verbose stack     at ChildProcess.emit (node:events:518:28)
38 verbose stack     at maybeClose (node:internal/child_process:1105:16)
38 verbose stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
39 verbose cwd E:\Dev\node_projects
40 verbose Windows_NT 10.0.22631
41 verbose node v20.11.0
42 verbose npm  v10.2.4
43 error code 1
44 error path E:\Dev\node_projects
45 error command failed
46 error command C:\Windows\system32\cmd.exe /d /s /c create-feathers test
47 verbose exit 1
48 timing npm Completed in 1866ms
49 verbose code 1
50 error A complete log of this run can be found in: E:\software\nodecache\_logs\2024-01-24T18_33_45_100Z-debug-0.log

System configuration

Module versions (especially the part that's not working): latest version of Feathers.

NodeJS version: v20.11.0

Operating System: Windows 11

daffl commented 5 months ago

This should be fixed via https://github.com/feathersjs/feathers/pull/3403

Running npm create feathers@latest again and making sure it uses v5.0.20 or later should solve the issue.

JustADataConstruct commented 5 months ago

While the anterior problem has indeed disappeared (thank you!), alas it has a new complaint:

PS E:\dev\node> npm create feathers@latest test
Need to install the following packages:
create-feathers@5.0.20
Ok to proceed? (y)
Error: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'e:'

Hooray! Your Feathers app is ready to go! 🚀
Go to the test folder to get started.

The folder indeed has been created, but it is empty. I'm assuming it's getting the "e:" part from the routes, which again are defined on npmrc as

prefix=E:\software\nodeprefix
cache=E:\software\nodecache
navn0000 commented 5 months ago

Encountering this error when attempting to generate a new service. image

daffl commented 5 months ago

How fun 😞 I can only join the many other package maintainers in saying that upgrading to ES modules has been very unpleasant. Anyway. This should be fixed via https://github.com/feathersjs/feathers/pull/3405 and work in v5.0.20 or later.

JustADataConstruct commented 5 months ago

It is fixed indeed on my side, thank you for your work!