使用webpack遇到的大坑webpack-dev-server

宋烨烁
2023-12-01

node版本9 

"dependencies": {

"nvm": "0.0.4",

"webpack-cli": "^4.9.1",

"webpack-command": "^0.5.1"

},

"devDependencies": {

"webpack": "^4.46.0"

}

运行webpack-dev-server的时候就会遇到

bash: webpack-dev-server: command not found

运行npx webpack-dev-server的时候就会遇到

[webpack-cli] You need to install 'webpack-dev-server' for running 'webpack serve'.
SyntaxError: Unexpected token {

重新安装webpack 版本  出现xcode问题

最后使用nvm use 14  采用最新版本node

运行webpack server成功

 类似资料: