The login page can be accessed normally, and the menu can be accessed normally. Once the page is refreshed, it will be blank or not easy to make
at the same time, the console will report an error: unexpected token & lt;
This is because refreshing the page needs to re request the JS file, but the path has changed when the request is made, and the content of index.html is requested back
Solution
in Vue config – & gt; In index.js bulid,
configure assetspublicpath as the absolute path of your static resources. How to refresh this path will not change
build: {
// Template for index.html
index: path.resolve(__dirname, '../nqia-ias/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../nqia-ias'),
assetsSubDirectory: 'static',
assetsPublicPath: '/s/nqia-ias/',
......
}
Read More:
- vue VM682:1 Uncaught SyntaxError: Unexpected token u in JSON at position 0
- Template cannot be rendered due to the joint query of populate in mongoose: syntax error: unexpected token r in JSON at position 0
- How to Solve Error: “syntax error near unexpected token `newline’”
- R: Data frame index error “unexpected token”
- Vue ElementUI el-dropdown Error: Uncaught TypeError: Cannot read property ‘disabled‘ of null
- [Solved] Maven Error: The packaging for this project did not assign a file to the build artifact
- Webpack Pack and compress ES6 files with errors: ERROR in js/xxxxxx.js from UglifyJs Unexpected token punc ()
- file_name.sh: 3: Syntax error: “(“ unexpected [How to Solve]
- How to Solve Uncaught Error: Syntax error, unrecognized expression:#
- line 1: syntax error: unexpected “(“ [How to Solve]
- Parsing error in eslint parsing: unexpected token [How to Solve]
- [Solved] Vue + uniapp Uncaught TypeError: Cannot read property ‘getters‘ of undefined
- [Solved] Vue Error: Uncaught TypeError: Cannot read property ‘getters‘ of undefined
- Vue: How to Solve Error uncaught (in promise) cancel
- Vue Uncaught (in promise) Error: Navigation cancelled from “/home“ to “/login“ with a new navigation
- [Solved] eslint Error: error Parsing error: Unexpected token <
- [Solved] Error: Waveform5.vwf.vt(30): near “1“: syntax error, unexpected INTEGER NUMBER, expecting ‘)‘ Erro
- [Solved] Error c2226: syntax error: unexpected ‘lpstr’ type
- [Solved] The Shell Script error: syntax error: “(” unexpected “)
- How to Fix the common Warning Errors after Vue Project Startup