iamarsenibragimov's avatar

sh: vite: command not found

Hey hey!

I have built my project on a local environment and now I'm trying to run it on a server but when I do

npm run build

I get

This is an image

what am I doing wrong? Any ideas on how to fix it?

0 likes
7 replies
azimidev's avatar

I believe the module "node:path" is missing. It appears to be a required module for the Vite framework you're using. You should check the version of node and npm you are using on your remote hosting. Make sure that it is compatible with the version of Vite you are using. If not, upgrade or downgrade the version of node and npm to match the version required by Vite. You can also try uninstalling and reinstalling the Vite framework and its dependencies to see if that resolves the issue.

1 like
ahishamali's avatar

if you have nvm just change to node v16 or higher and all will be good

example:

nvm use 16.18.0
mdnurulmomen's avatar

For future searchers !

Steps I followed:

  1. Remove the node_modules folder,
  2. Install the dependency using npm install
  3. Run the server using php artisan serve
  4. Finally run the dev server using npm run dev

It should start the dev server and all your JavaScript code should be compiled.

1 like
robertard's avatar

When you see the error sh: vite: command not found while running your project on a server, it means the system can’t locate the Vite executable because it’s either not installed globally, or the server isn’t aware of the local node_modules/.bin path where it resides. This often happens when moving a project from your local machine to a server without reinstalling dependencies (npm install or yarn install) or without adjusting your run command to use npx vite instead. To fix it, ensure your server has Node.js installed, run your package manager’s install command in the project root, and then run Vite using npx vite or a package script defined in package.json....Try Once: www.kisskhd.app

Please or to participate in this conversation.