[英]node installed but npm is not installed please help me to fix
node -v is working but, node -v 正在工作,但是,
npm -v is not working, error npm -v 不工作,错误
C:\Users\HackerGprat>node -v
v19.2.0
C:\Users\HackerGprat>npm -v
node:internal/modules/cjs/loader:1039
const err = new Error(message);
^
Error: Cannot find module '../package.json'
Require stack:
- C:\Users\HackerGprat\AppData\Roaming\npm\node_modules\npm\lib\cli.js
- C:\Users\HackerGprat\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
←[90m at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)←[39m
←[90m at Module._load (node:internal/modules/cjs/loader:885:27)←[39m
←[90m at Module.require (node:internal/modules/cjs/loader:1105:19)←[39m
←[90m at require (node:internal/modules/cjs/helpers:103:18)←[39m
at createEnginesValidation ←[90m(C:\Users\HackerGprat\←[39mAppData\Roaming\npm\node_modules\←[4mnpm←[24m\lib\cli.js:7:15←[90m)←[39m
at module.exports ←[90m(C:\Users\HackerGprat\←[39mAppData\Roaming\npm\node_modules\←[4mnpm←[24m\lib\cli.js:73:27←[90m)←[39m
at Object.<anonymous> ←[90m(C:\Users\HackerGprat\←[39mAppData\Roaming\npm\node_modules\←[4mnpm←[24m\bin\npm-cli.js:2:25←[90m)←[39m
←[90m at Module._compile (node:internal/modules/cjs/loader:1218:14)←[39m
←[90m at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)←[39m
←[90m at Module.load (node:internal/modules/cjs/loader:1081:32)←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: [
←[32m'C:\\Users\\HackerGprat\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli.js'←[39m,
←[32m'C:\\Users\\HackerGprat\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js'←[39m
]
}
Node.js v19.2.0
my doubt is i did not checked ☑ the options of automatic install necessary tools becuase it will take lots of mb so i skiped it.. and by default it was unchecked too [ ]我怀疑我没有检查 ☑自动安装必要工具的选项因为它会占用很多 mb 所以我跳过它..默认情况下它也没有被选中 [ ]
it did not working , and given me error,它没有工作,并给了我错误,
tried to copy all installation folder from sandbox to real pc,试图将所有安装文件夹从沙箱复制到真实电脑,
as you can see the last line正如你看到的最后一行
requireStack: [
←[32m'C:\\Users\\HackerGprat\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli.js'←[39m,
←[32m'C:\\Users\\HackerGprat\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js'←[39m
]
its pointing to AppData
folder,它指向
AppData
文件夹,
and saying there is npm
folder并说有
npm
文件夹
just delete
that npm folder
and reinstall the node只需
delete
该npm folder
并重新安装节点
and see it started again working..并看到它再次开始工作..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.