Pana / nrm

NPM registry manager, fast switch between different registries: npm, cnpm, nj, taobao
MIT License
2.81k stars 250 forks source link

nrm@1.2.1 cannot work in node-14.15 (win10) #81

Closed varlinor closed 1 month ago

varlinor commented 3 years ago

when I upgrade node from v12.x to v14.15 in windows10,after install nrm to global, the command throws error! just like below:

c:\>nrm ls
internal/validators.js:124
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

[TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
  at validateString (internal/validators.js:124:11)
  at Object.join (path.js:375:7)
  at Object.<anonymous> (D:\develop\node-v14.15.4-win-x64\node_global\node_modules\nrm\cli.js:17:20)
  at Module._compile (internal/modules/cjs/loader.js:1063:30)
  at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
  at Module.load (internal/modules/cjs/loader.js:928:32)
  at Function.Module._load (internal/modules/cjs/loader.js:769:14)
  at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
  at internal/main/run_main_module.js:17:47
] {
  code: 'ERR_INVALID_ARG_TYPE'
} 

after few times to try, finally, #79 give us the right way to fix it

so if you want your nrm@1.2.1 work rightly, you can rewrite the code at row 17th in your node_global/node_modules/nrm/cli.js ;

const NRMRC = path.join(process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'], '.nrmrc');

use USERPROFILE to replace HOME in win32 platform can fix local using temporarily.

At last ,Sincerely hope maintainer @Pana or @EmilyMew can merge pr #80 with to fix this bug!

FQLin commented 3 years ago

After I uninstalled 14.15.4 and reinstalled 12.20.1,I also have this bug.

rong17173 commented 3 years ago

I also have this bug, win10, node version 14.15.4

xiaofan9 commented 3 years ago

目前,只能先这样用着先(等到后期官方发包再改: npm i https://github.com/stefango/nrm.git#patch-1 -g

tyanbiao commented 3 years ago

same issue

Y334275 commented 3 years ago

I checked the source code, and find out you need add a environment variable call HOME, then, problem can be solved, i am not good at english, hope you can get it :)

FQLin commented 3 years ago

I checked the source code, and find out you need add a environment variable call HOME, then, problem can be solved, i am not good at english, hope you can get it :)

what is the value of the HOME env?

Y334275 commented 3 years ago

I checked the source code, and find out you need add a environment variable call HOME, then, problem can be solved, i am not good at english, hope you can get it :)

what is the value of the HOME env?

Node installation directory