安装vite for react npm后,运行dev不工作

ugmeyewa  于 11个月前  发布在  React
关注(0)|答案(2)|浏览(191)

在成功安装react js与vite后使用npm我当我写npm运行dev它显示此错误npm运行dev

> [email protected] dev
> vite

E:\nasheednaldo\node_modules\rollup\dist\native.js:64
                throw new Error(
                      ^

Error: Cannot find module @rollup/rollup-win32-ia32-msvc. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.
    at requireWithFriendlyError (E:\nasheednaldo\node_modules\rollup\dist\native.js:64:9)
    at Object.<anonymous> (E:\nasheednaldo\node_modules\rollup\dist\native.js:73:48)
    ... 2 lines matching cause stack trace ...
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at cjsLoader (node:internal/modules/esm/translators:284:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:234:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:217:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24) {
  [cause]: Error: The specified module could not be found.
  \\?\E:\nasheednaldo\node_modules\@rollup\rollup-win32-ia32-msvc\rollup.win32-ia32-msvc.node
      at Module._extensions..node (node:internal/modules/cjs/loader:1327:18)
      at Module.load (node:internal/modules/cjs/loader:1091:32)
      at Module._load (node:internal/modules/cjs/loader:938:12)
      at Module.require (node:internal/modules/cjs/loader:1115:19)
      at require (node:internal/modules/helpers:130:18)
      at requireWithFriendlyError (E:\nasheednaldo\node_modules\rollup\dist\native.js:62:10)
      at Object.<anonymous> (E:\nasheednaldo\node_modules\rollup\dist\native.js:73:48)
      at Module._compile (node:internal/modules/cjs/loader:1241:14)
      at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
      at Module.load (node:internal/modules/cjs/loader:1091:32) {
    code: 'ERR_DLOPEN_FAILED'
  }
}

字符串
Node.js v20.9.0
现在我试图重新安装它,但它一直发生每次。

brc7rcf0

brc7rcf01#

下载此软件您的错误将在安装时自动修复“Visual C++ Redistributable for Visual Studio 2015 x64”

z9gpfhce

z9gpfhce2#

这是我2天前遇到的同样的问题。只需按照以下步骤操作:
1.从here下载并安装Microsoft Visual C++ 2015 Redistributable(x64)
2.重新启动系统
1.删除旧项目并创建一个新项目(使用vite和npm)
1.确保在npm run dev之前运行npm install
这些步骤将工作(最有可能),这对我来说是有效的。

相关问题