gpt4 book ai didi

npm - 'webpack-dev-server' 未被识别为内部或外部命令,

转载 作者:行者123 更新时间:2023-12-04 11:13:24 25 4
gpt4 key购买 nike

我按照关于 pluralsight 的教程使用 gitbash 通过 github 克隆了这个 Webpack Starter 包。我正在尝试通过 Visual Studio Code 的集成终端访问 webpack,但出现以下错误。我是新手,所以请帮助我。

我正在运行命令

 Raza Zaidi@RazaZaidi-PC MINGW64 ~/webpack-starter (master)
$ npm run dev

然后发生以下错误
> yet-another-webpack-es6-starterkit@1.0.0 dev C:\Users\Raza Zaidi\webpack-starter
> webpack-dev-server --open --config webpack/webpack.config.dev.js

'webpack-dev-server' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! yet-another-webpack-es6-starterkit@1.0.0 dev: `webpack-dev-server --open --config webpack/webpack.config.dev.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the yet-another-webpack-es6-starterkit@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Raza Zaidi\AppData\Roaming\npm-cache\_logs\2018-08-14T20_16_29_017Z-debug.log

最佳答案

Webpack 命令应位于以下位置:node_modules\.bin\
在这种情况下,在 package.json 文件中,我们指的是 webpack-dev-server,但本地 webpack-dev-server 不存在。

首先运行以下命令进行全局安装:

npm install -g webpack-dev-server

第二次执行本地安装命令,会创建 node_modules\.bin\webpack-dev-server :

npm install webpack-dev-server --save-dev

关于npm - 'webpack-dev-server' 未被识别为内部或外部命令,,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51849282/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com