Failed to resolve module specifier “vue”. Relative references must start with either “/”, “./”, or “../” – deploy Vue Vite on Netlify

I am getting this error: Uncaught TypeError: Failed to resolve module specifier "vue". Relative references must start with either "/", "./", or "../".

I want to deploy the frontend of my app on Netlify, but I keep getting this error. What are those relative references? Does it have something to do with that my vue file is not in root directory, but in frontend/vue folder?

enter image description here

When I change base directory to /frontend/ I get 404 error: enter image description here

Do I have to add something for example in public _redirects folder? I know that using React I had to add /* /index.html 200. I added that here, but it didn’t help.

This is my folder structure:

enter image description here

  • You need to build your app for it to run in production, and I see you have no build command. Probably yarn build or npm run build depending on what’s in your package.json. You’ll also need to set the “Publish directory”, usually dist by default which is where all your build files end up.

    – 

Leave a Comment