1. 程式人生 > >從github下載的vue項目啟動寶Cannot Get錯誤

從github下載的vue項目啟動寶Cannot Get錯誤

cto true map host bsp port read 項目啟動 pub

從github下載的vue項目啟動寶Cannot Get錯誤,網上參考出現該錯誤來源很多,這裏先總結遇到的第一個解決方法。

參考地址:

https://www.cnblogs.com/anns/p/7457952.html

代碼修改如下:

在config-》index.js中修改 assetsPublicPath: ‘/‘, 為 assetsPublicPath: ‘./‘, 再執行 npm run dev ,問題解決

 build: {
        env: require(‘./prod.env‘),
        index: path.resolve(__dirname, ‘../dist/modules/index/index.html‘),
        phone: path.resolve(__dirname, 
‘../dist/modules/phone/phone.html‘), assetsRoot: path.resolve(__dirname, ‘../dist‘), assetsSubDirectory: ‘static‘, assetsPublicPath: ‘./‘, productionSourceMap: true, // Gzip off by default as many popular static hosts such as // Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to: // npm install --save-dev compression-webpack-plugin productionGzip: false, productionGzipExtensions: [‘js‘, ‘css‘], bundleAnalyzerReport: process.env.npm_config_report },

註意,不能更改dev下的代碼。

附上下來項目的來源:

https://github.com/chen1218chen/vue-cli-multi-page

從github下載的vue項目啟動寶Cannot Get錯誤