Vue elemnt admin NPM run dev run error
Description:
vue-element-admin 4.4.4
There is the previous Vue element admin template in the computer, which can run normally, but the following error will be prompted when pulling the latest version
Error content
DONE Compiled successfully in 4163ms 4:26:31 ├F10: PM┤
App running at:
- Local: http://localhost:9528
- Network: http://192.168.70.192:9528
Note that the development build is not optimized.
To create a production build, run npm run build.
events.js:291
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn cmd',
path: 'cmd',
spawnargs: [ '/c', 'start', '""', '/b', 'http://localhost:9528' ]
}
Solution:
Comment out open: true in vue.config.js
Description of the modified part
For vue projects, find the devServer configuration proxy in vue.config.js
devServer: {
port: 8081, // port
// open: true, // whether to open the browser automatically
overlay: {
warnings: false,
errors: true
},
hot: true, // simply set to true, if the compiler reports an error, it will throw an error and you change it to the correct one, which will trigger a recompile again and the whole browser will be refreshed!
headers: {
'Access-Control-Allow-Origin': '*', //Allows access to all domains
'Access-Control-Allow-Credentials': 'true' // whether to allow subsequent requests to carry authentication information (cookies), the value can only be true, otherwise do not return
},
host: '0.0.0.0',
proxy: { // proxy
'/admin': {
target: 'http://192.168.1.100:8080', // backend port address
changeOrigin: true, // option to host the site virtually based on the name, if not configured, the request will report a 404 If the interface crosses the domain, this parameter needs to be configured
ws: true, // true/false, whether to proxy websockets
secure: false, // if the interface is https, you need to configure this parameter
pathRewrite: {
'^/admin': '' // pathRewrite is the request path to redirect to match the correct request address when using the proxy for proxying
}
}
}
}
Read More:
- [Solved] Temporary error: Error: spawn E:\vue3-vite\my-app\node_modules\esbuild\esbuild.exe ENOENT
- [Solved] Error spawn CMD enoent errno when starting Vue project: – 4058
- [Solved] gyp ERR! stack Error: Could not find any Python installation to use
- [Solved] NPM node ERROR in main..js from Terser ChildProcessWorker.initialize Excaption
- [Solved] VUE3 Error: Error: ENOSPC: System limit for number of file watchers reached
- [Solved] Vue3 npm ERR code ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC
- [Solved] error C:\Users\HP\Desktop\VueProject\vue_cli\node_modules\node-sass: Command failed.Exit code: 1
- [Solved] proxy Configure Error: Error occured while trying to proxy to:
- [Solved] Error Rule can only have one resource source (provided resource and test + include + exclude)
- [Solved] Error Rule can only have one resource source (provided resource and test + include + exclude)
- Interface request error 504 gateway time out [How to Solve]
- How to Solve NPM installation -g @view/client Error
- The addition, deletion and modification of DOM in JS Foundation
- How to Block a frame with origin from accessing a cross origin frame
- If the request parameter is formdata, use the Ajax operation
- After Vite starts, it will prompt “network: use ` — host ` to expose”, and the service cannot be accessed through network IP
- [Solved] npm Error: Class extends value undefined is not a constructor or null
- [Solved] Uncaught SyntaxError: Unexpected token ‘<‘
- [Solved] Vue item packaging error: Failed to load resource: the server responded with a status of 404 (Not Found)
- Vue refreshes the current page (no flash screen will appear)