vue cli - Uncaught SyntaxError: Unexpected token <

前端 未结 14 2264
说谎
说谎 2020-12-31 03:39

I create my project with vue-cli 3.0. Initially it runs ok. But after I -c then npm run serve again, it keep throwing erro

14条回答
  •  不思量自难忘°
    2020-12-31 04:07

    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.

提交回复
热议问题