0

I created a new React project using Vite react but after running npm install and npm run dev, I get the error below:

node:internal/modules/cjs/loader:1327 
return process.dlopen(module, path.toNamespacedPath(filename)); ^ 

Error: The specified module could not be found. 
\\?\D:\Ostad\MERN\Student\vite-project\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 Object.<anonymous> (D:\Ostad\MERN\Student\vite-project\node_modules\rollup\dist\native.js:60: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) at Module._load
(node:internal/modules/cjs/loader:938:12) { code: 'ERR_DLOPEN_FAILED' }
Node.js v20.9.0

Error

I previously created another React project without using Vite and everything worked fine. So, I know the issue is setting it up with Vite.

What could be the problem please?

5
  • can we see your "scripts" section in your package.json? try running npm run dev instead of npm install npm run dev Commented Nov 20, 2023 at 18:20
  • "scripts": { "dev": "vite", "build": "vite build", "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview" }, Commented Nov 20, 2023 at 18:22
  • I run only ' npm run dev ' but it's error. Commented Nov 20, 2023 at 18:23
  • Does this answer your question? Error in React vite project due to rollup dependency (module not found) Commented Dec 27, 2023 at 1:46
  • 1. npm install -g create-vite 2. npm create vite@latest my-NewReact-app --template react 3. cd my-NewReact-app 4. Open Project in VS Code: -> code . 5. Then After New Windows open, Install Dependencies in Project folder using below syntax: -> npm install 6. Start Development Server: npm run dev Commented Jan 6, 2024 at 8:59

2 Answers 2

1

try removing the node_modules folder and the package-lock.json file, after that, install the dependencies again npm install, make sure there is the dev command in the package.json scripts and run npm run dev again, this should help you

Sign up to request clarification or add additional context in comments.

Comments

0

I updated my Node version by downloading it from the official site: https://nodejs.org/en/download then I tried npm run dev and it worked just fine!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.