Deploying vue returns unexpted token < after build

I have had no problems with deploying my vue projects so far and uploading it to my website. However suddenly Im getting the following errormessage after I have been running

npm run build 

and uploading the files in my distfolder.

Uncaught SyntaxError: Unexpected token ‘<’ chunk-vendors.468a5298.js:1
Uncaught SyntaxError: Unexpected token
‘<’ app.f775d578.js:1

The only difference I can notice is that vue now seems to recommend using yarn.

I made a new project just for testing using yarn but with the same error.

  1. vue create my-application
  2. yarn install
  3. yarn serve
  4. yarn build

uploading content in distfolder to my website - same errormessage

Anyone else experienced this?

My old build works without any problems

Im using @vue/cli 4.5.6

Usually that error message indicates that an HTML file is being served up in place of a JS file.

In this case it appears to be chunk-vendors.468a5298.js. Take a look in your browser’s Network tab and check what’s coming back for that file. Most likely it’ll either be your index.html or a 404 page.

Either way, you probably need to tweak your server settings to ensure the desired file gets served up instead.

It is very strange since I have deployed millon of times with no errors. Also since I installed a totally fresh vue project that I deployed emidately.

How can I do this?

Here is my network tab in console:

The first thing you need to do is figure out what response is coming back. Click on the relevant rows in the Network tab to check the response. That may give you a hint about what the problem is.

Do those paths and file names appear to be correct given the files you’ve uploaded?

I got it working now. Deleted the folder on my ftp and created a new one. Dont know this solved it but it did :slight_smile:

hey can you describe how did you solved this error…?
I have same issue…

hm. I cant remember exactly more than I wrote above. It might be some cache issue. dont know. sorry.

Hi, I have the same problem too and if you find any solution could you please share

In My Case, The file vue.config.js has different project path. Make sure you have the same name as your project. For Example:

process.env.VUE_APP_VERSION = process.env.npm_package_version; module.exports = { publicPath: process.env.NODE_ENV === 'production' ? '/yourproject/' : '/', chainWebpack: config => { config .plugin('html') .tap(args => { args[0].title = 'Brand' return args }) config.plugins.delete('prefetch') }, pluginOptions: { i18n: { locale: 'en', fallbackLocale: 'en', localeDir: 'locales', enableInSFC: true } } }