在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML5/ vue打包時報錯提示SyntaxError: Unexpected token

vue打包時報錯提示SyntaxError: Unexpected token (1:5)

項目在npm run build打包時報錯,但是npm run dev可以正常執(zhí)行

//
building for production...{ SyntaxError: Unexpected token (1:5)

at Parser.pp$4.raise (D:\ky-tesla\zhihuijingqu-web\node_modules\acorn-dynamic-import\node_modules\acorn\dist\acorn.js:2488:13)
at Parser.pp.unexpected (D:\ky-tesla\zhihuijingqu-web\node_modules\acorn-dynamic-import\node_modules\acorn\dist\acorn.js:623:8)
at Parser.pp.expect (D:\ky-tesla\zhihuijingqu-web\node_modules\acorn-dynamic-import\node_modules\acorn\dist\acorn.js:617:26)
at Parser.pp$3.parseParenAndDistinguishExpression (D:\ky-tesla\zhihuijingqu-web\node_modules\acorn-dynamic-import\node_modules\acorn\dist\acorn.js:2043:38)
at Parser.pp$3.parseExprAtom (D:\ky-tesla\zhihuijingqu-web\node_modules\acorn-dynamic-import\node_modules\acorn\dist\acorn.js:1978:41)
at Parser.parseExprAtom (D:\ky-tesla\zhihuijingqu-web\node_modules\acorn-dynamic-import\lib\inject.js:58:31)
at Parser.pp$3.parseExprSubscripts (D:\ky-tesla\zhihuijingqu-web\node_modules\acorn-dynamic-import\node_modules\acorn\dist\acorn.js:1872:19)
at Parser.pp$3.parseMaybeUnary (D:\ky-tesla\zhihuijingqu-web\node_modules\acorn-dynamic-import\node_modules\acorn\dist\acorn.js:1849:17)
at Parser.pp$3.parseExprOps (D:\ky-tesla\zhihuijingqu-web\node_modules\acorn-dynamic-import\node_modules\acorn\dist\acorn.js:1791:19)
at Parser.pp$3.parseMaybeConditional (D:\ky-tesla\zhihuijingqu-web\node_modules\acorn-dynamic-import\node_modules\acorn\dist\acorn.js:1774:19)
at Parser.pp$3.parseMaybeAssign (D:\ky-tesla\zhihuijingqu-web\node_modules\acorn-dynamic-import\node_modules\acorn\dist\acorn.js:1750:19)
at Parser.pp$3.parseExpression (D:\ky-tesla\zhihuijingqu-web\node_modules\acorn-dynamic-import\node_modules\acorn\dist\acorn.js:1722:19)
at Parser.pp$1.parseStatement (D:\ky-tesla\zhihuijingqu-web\node_modules\acorn-dynamic-import\node_modules\acorn\dist\acorn.js:777:45)
at Parser.parseStatement (D:\ky-tesla\zhihuijingqu-web\node_modules\acorn-dynamic-import\lib\inject.js:45:31)
at Parser.pp$1.parseTopLevel (D:\ky-tesla\zhihuijingqu-web\node_modules\acorn-dynamic-import\node_modules\acorn\dist\acorn.js:672:23)
at Parser.parse (D:\ky-tesla\zhihuijingqu-web\node_modules\acorn-dynamic-import\node_modules\acorn\dist\acorn.js:529:15)
at Object.parse (D:\ky-tesla\zhihuijingqu-web\node_modules\acorn-dynamic-import\node_modules\acorn\dist\acorn.js:3378:37) pos: 5, loc: Position { line: 1, column: 5 }, raisedAt: 6 }

"webpack": "^3.6.0",

"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0"

打包過程中還出現(xiàn)的標紅的相關(guān)代碼

//
ERROR in chunk app [initial]
static/js/[name].[chunkhash].js
Unexpected token (205:27)
| var urlHost = process.env.API_HOST;
| var self = this;
| this.$axios.post(http://d.d.d.d:e/ + 'api/xxx', {
| "templateName": goodsName,
| "merchantId": merchantId,

Build failed with errors.

npm ERR! Windows_NT 10.0.17134
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "build"
npm ERR! node v6.10.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! zhihuijingqu-web@1.0.0 build: node build/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zhihuijingqu-web@1.0.0 build script 'node build/build.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the zhihuijingqu-web package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node build/build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs zhihuijingqu-web
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls zhihuijingqu-web
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! D:ky-teslazhihuijingqu-webnpm-debug.log

問題出現(xiàn)后嘗試過修改請求、node_modules等都沒有解決

相關(guān)代碼

//

rules: [
  {
    test: /\.vue$/,
    loader: 'vue-loader',
    // options: vueLoaderConfig
    options: {
      loaders:{}
    }
  },
  {
    test: /\.js$/,
    loaders: ['babel-loader'],
    exclude: /node_modules/,
    include: [resolve('src'), resolve('test'), resolve('node_modules/element-ui/src/mixins/emitter.js'),]
  },
  {
    test: /\.css$/, 
    include: [ 
      /src/,//表示在src目錄下的css需要編譯 
      '/node_modules/element-ui/lib/'  //增加此項 
    ], 
    loader: "style-loader!css-loader"
  },
  {
    test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
    loader: 'url-loader',
    options: {
      limit: 10000,
      name: utils.assetsPath('img/[name].[hash:7].[ext]')
    }
  },
  {
    test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
    loader: 'url-loader',
    options: {
      limit: 10000,
      name: utils.assetsPath('media/[name].[hash:7].[ext]')
    }
  },
  {
    test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
    loader: 'url-loader',
    options: {
      limit: 10000,
      name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
    }
  }
]

},

在剛開始時打包是正常的但是后來用npm打包就一直報錯?求大神指導一下?

回答
編輯回答
青檸

最后在git管理上面找到了,是同事在修改代理時confing/prod.env.js的API_HOST:'"http://xxxxxxxxx"'里少加雙引號

2017年8月5日 00:43