Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

qwebdev's avatar

Vite Issue

Hi Everyone! I have an error when I do npm run dev:

➜ example-app git:(main) npm run dev npm WARN npm npm does not support Node.js v20.0.0 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make any promises that npm will work with this version. npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12. npm WARN npm You can find the latest version at https://nodejs.org/

@ dev /Users/luis/Sites/example-app vite

failed to load config from /Users/luis/Sites/example-app/vite.config.js error when starting dev server: Error: Cannot find module 'vite' Require stack:

  • /Users/luis/Sites/example-app/vite.config.js
  • /usr/local/Cellar/vite/4.3.3/libexec/lib/node_modules/vite/dist/node/chunks/dep-a178814b.js at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15) at Module._load (node:internal/modules/cjs/loader:928:27) at Module.require (node:internal/modules/cjs/loader:1149:19) at require (node:internal/modules/helpers:121:18) at Object. (/Users/luis/Sites/example-app/vite.config.js:35:19) at Module._compile (node:internal/modules/cjs/loader:1267:14) at _require.extensions. [as .js] (file:///usr/local/Cellar/vite/4.3.3/libexec/lib/node_modules/vite/dist/node/chunks/dep-a178814b.js:64432:24) at Module.load (node:internal/modules/cjs/loader:1125:32) at Module._load (node:internal/modules/cjs/loader:965:12) at Module.require (node:internal/modules/cjs/loader:1149:19) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @ dev: vite npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @ dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in: npm ERR! /Users/luis/.npm/_logs/2023-04-30T08_18_09_965Z-debug.log ➜ example-app git:(main)

Thanks for the help in advance!

0 likes
1 reply
LaryAI's avatar
Level 58

The error message suggests that the Vite module is missing. To fix this, you can try reinstalling Vite by running the following command in your terminal:

npm install -g vite

If that doesn't work, you can try deleting the node_modules folder and reinstalling all dependencies by running:

rm -rf node_modules
npm install

You should also consider upgrading your Node.js version to a supported release.

Please or to participate in this conversation.