vue cli - Uncaught SyntaxError: Unexpected token <

前端 未结 14 2188
说谎
说谎 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:00

    I have the same problem. in index.html file , I just write this script tag,like this :

      
    

    if I change src attr like this:

     
    

    ok, no error 'Unexpected token <' dispaly.

    here is a another problem happened,it is upsetting to me .

    online build product tests that dispaly I can't access this site and get resource. OMG ! ok, I change this src again like this:

    
    

    and then make some changes in vue.config.js like this:

    baseUrl:'./'
    assetsDir:'./'
    

    so,online everything is ok ,but in my local project run it will get this error.

    finally,I find this :

    online url address: http://xxxxx.cn/test0001/#/

    local url address: http://192.168.5.108:9000/test0001/#/

    (ps:test0001 params can't remove,my project need it)

    if I remove this params 'test0001', this error isn't display in my local project test .

    I guess build and development environment's difference cause this error,and my params test0001 in url address.

    finally,I just use a param to diff this product and development to solve it.

    if someone meet this problem like me , please share your solution.

提交回复
热议问题