I create my project with vue-cli 3.0. Initially it runs ok. But after I then npm run serve again, it keep throwing erro
I met the same error here, it's just my case happened when I deploy the app, it works good on local env.
After some search, I followed vue-cli's official guidance on publicPath below:
You will need to set publicPath if you plan to deploy your site under a sub path, for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/, then publicPath should be set to "/bar/". In most cases please use '/' !!! Detail: https://cli.vuejs.org/config/#publicpath
I change publicPath from '/' to '/bar/' and the error disappears.