npm install 抛出预期的“0.15.7”,但在新的 vite 项目上得到“”

问题描述 投票:0回答:1

我刚刚创建了一个新的 vite 项目,在执行 npm install 时出现以下错误。

node.js:16.17.0

npm:8.15.0

npm ERR! C:\xxx\GIT\NewTestProject\node_modules\esbuild\install.js:93
npm ERR!     throw new Error(`Expected ${JSON.stringify("0.15.7")} but got ${JSON.stringify(stdout)}`);
npm ERR! C:\xxx\GIT\NewTestProject\node_modules\esbuild\install.js:93
npm ERR!
npm ERR! Error: Expected "0.15.7" but got ""
npm ERR!     at validateBinaryVersion (C:\xxx\GIT\NewTestProject\node_modules\esbuild\install.js:93:11)
npm ERR!     at C:\xxx\GIT\NewTestProject\node_modules\esbuild\install.js:240:5

package.json

{
  "name": "newtestproject",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "vue": "^3.2.37"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^3.1.0",
    "vite": "^3.1.0"
  }
}

更新:

由于这是一个值得注意的问题,而我的答案刚刚被否决,请随时分享您的解决方案!

node.js vue.js npm vite
1个回答
-2
投票

以管理员身份运行cmd解决了问题。

© www.soinside.com 2019 - 2024. All rights reserved.