I installed Node Version Manager (nvm) to use the latest version of Node (13.6.0). After running the command nvm use 13.6.0
, I was able to use the latest version of Node. However, when I tried running npm init
, I encountered the following error:
internal/modules/cjs/loader.js:976
throw err;
^
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:973:15)
at Function.Module._load (internal/modules/cjs/loader.js:855:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
To solve this issue, I added the path to each version of Node to the system variables. This was done on a Windows 10 (x64) machine.