繁体   English   中英

在 windows 11 中安装节点版本 16.16.0 后,在 npm --version 命令中显示错误

[英]after installing node version 16.16.0 in windows 11 it is showing error in npm --version command

错误图像

    npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
node:internal/modules/cjs/loader:933
  const err = new Error(message);
              ^

Error: Cannot find module './internal/re'
Require stack:
- C:\Users\HP\AppData\Roaming\npm\node_modules\npm\node_modules\semver\index.js
- C:\Users\HP\AppData\Roaming\npm\node_modules\npm\lib\cli.js
- C:\Users\HP\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
←[90m    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)←[39m
←[90m    at Function.Module._load (node:internal/modules/cjs/loader:778:27)←[39m
←[90m    at Module.require (node:internal/modules/cjs/loader:1005:19)←[39m
←[90m    at require (node:internal/modules/cjs/helpers:102:18)←[39m
    at Object.<anonymous> (C:\Users\HP\AppData\Roaming\npm\node_modules\←[4mnpm←[24m\node_modules\←[4msemver←[24m\index.js:2:20)
←[90m    at Module._compile (node:internal/modules/cjs/loader:1105:14)←[39m
←[90m    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)←[39m
←[90m    at Module.load (node:internal/modules/cjs/loader:981:32)←[39m
←[90m    at Function.Module._load (node:internal/modules/cjs/loader:822:12)←[39m
←[90m    at Module.require (node:internal/modules/cjs/loader:1005:19)←[39m {
  code: ←[32m'MODULE_NOT_FOUND'←[39m,
  requireStack: [
    ←[32m'C:\\Users\\HP\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\semver\\index.js'←[39m,
    ←[32m'C:\\Users\\HP\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli.js'←[39m,
    ←[32m'C:\\Users\\HP\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js'←[39m
  ]
}

安装后我已经重新启动了我的电脑 我已经尝试卸载然后再次安装

请帮忙!!!

  1. 如果未删除,请删除node_modulespackage-lock.json
  2. 运行npm cache clean --force
  3. 运行npm install --force

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM