首页 > 其他分享 > Unable to load '@webpack-cli/serve' command 报错问题

Unable to load '@webpack-cli/serve' command 报错问题

时间:2023-06-27 23:33:30浏览次数:44  
标签:load cli color js webpack 报错 change row

[webpack-cli] Unable to load '@webpack-cli/serve' command
[webpack-cli] TypeError: options.forEach is not a function
at WebpackCLI.makeCommand (E:\vue-workspace\change-row-color\node_modules\webpack-cli\lib\webpack-cli.js:173:21)
at ServeCommand.apply (E:\vue-workspace\change-row-color\node_modules\@webpack-cli\serve\lib\index.js:41:19)
at loadCommandByName (E:\vue-workspace\change-row-color\node_modules\webpack-cli\lib\webpack-cli.js:907:35)
at async Command.<anonymous> (E:\vue-workspace\change-row-color\node_modules\webpack-cli\lib\webpack-cli.js:1462:17)
at async Promise.all (index 0)
at async WebpackCLI.run (E:\vue-workspace\change-row-color\node_modules\webpack-cli\lib\webpack-cli.js:1500:9)
at async runCLI (E:\vue-workspace\change-row-color\node_modules\webpack-cli\lib\bootstrap.js:11:9)
npm ERR! errno 2
npm ERR! [email protected] dev: `webpack serve`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] 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! D:\soft\nodejs\node_cache\_logs\2023-06-27T12_59_47_312Z-debug.log
PS E:\vue-workspace\change-row-color> npx webpack --version
webpack 5.42.1
webpack-cli 4.7.2

 

应该是版本不兼容导致的

npm install -D webpack-cli   下载最新的 webpack-cli  

 

下载样式加载器

npm i [email protected] [email protected] -D

 

 

const path=require('path')//引入node的模块

const Htmlplugin=require('html-webpack-plugin')
//创建一个htnl插件示例
const htmlplugin=new Htmlplugin({
    template: './src/index.html',
    filename: './index.html'
})


//使用node.js的导出语法,向外导出一个webpack的配置对象
module.exports={
    entry: path.join(__dirname,'./src/index.js'),//指定处理的文件,不指定默认./src/index.js
    //代表webpack运行的模式,可选至有两个 development 和 production (注释会清楚并深度压缩)
    mode:'production',
    //指定生成的文件存放路径
    output: {
        path: path.join(__dirname,'dist'),//指定文件存放目录,
        filename: 'main.js'
    },
    plugins:[htmlplugin],
    devServer: {
        open: true,
        port: 8081
    },
    module:{//第三方模块匹配规则
     rules:[
        {test:/\.css$/,use:['style-loader','css-loader']}]
    }
}

 

标签:load,cli,color,js,webpack,报错,change,row
From: https://www.cnblogs.com/ptcnblog/p/17509936.html

相关文章

  • eclipse中使用maven插件的有关问题:Updating index central|http://repo1.maven.org/m
    eclipse中使用maven插件的问题:Updatingindexcentral|http://repo1.maven.org/maven2问题产生如下:因为单位使用了过滤,访问Internet时,超过10M的内容就拒绝。因为maven插件在初始时,需要下载Maven的index文件,这个文件比较大,有38M多,下载不成功。所以造成使用Maven添加依赖项时(AddDep......
  • Spring Boot系列教程一:Eclipse安装spring-tool-suite插件
    一.前言    一直使用eclipse,个人习惯选用Eclipse+spring-tool-suite进行开发,特别注意Eclipse要选用对应的spring-tool-suite进行安装,这点笔者浪费了好长时间,以下为对应的版本。eclipse-kepler.4.3.1–>springsource-tool-suite-RELEASE-e4.3.1-updatesite.zipecl......
  • 2023-06-27 上传微信小程序报错:{"errcode":80082,"errmsg":"get plugin(id: wxxxxxxxx
    首先80082原因是你使用的一个id为wxxxxxxxxxxxxx的插件没有授权,所以就禁止你上传了,解决方案也很简单,只需在微信小程序后台==》设置==》第三方设置==》插件管理里面重新添加该插件即可。但是。如果这个id为wxxxxxxxxxxxxx的插件你搜索不到,嘿嘿,那就蛋疼了。你需要在代码里找出这个i......
  • Windows下安装ClickHouse图文教程
    @[toc]ClickHouse是没有Windows版的,所以我们要想安装在windows上,一般会选择安装在Docker容器中1.安装WSL2因为在Docker运行的时候需要使用Linux内核,WSL2是Windows10专业版和企业版的功能,它允许在Windows上运行原生的Linux二进制文件。DockerDesktopforWindows使用WS......
  • PHP代码加密实战过程 Swoole Loader
    帮一个客户处理一个小程序bug修复,前面不知道客户是直接购买一个倒闭的公司产品,还是破解版本的。其中一些核心工具类代码进行了加密,通过排查就找到了SwooleCompiler 今天演示下如何进行代码加密:大致步骤如下:注册 SwooleCompiler 账号地址:Swoole-Compiler-最佳PHP......
  • Eclipse3.6 + Tomcat7 + Jdk1.6配置
     Eclipse3.6+Tomcat7+Jdk1.6配置管理Eclipse上的tomcat的插件SysdeoEclipseTomcatLauncherpluginhttp://www.eclipsetotale.com/tomcatPlugin.html-----正文开始----一直以来都是很容易的将eclipse与tomcat结合使用,但是最近想试用tomcat7的时候,却突然发现eclipse将web服务......
  • elementUI中upload自定义上传行为 http-request属性
    需求是上传一个xlsx后台处理完再返回xlsx流upload请求需要添加responseType:'blob'属性所有要扩展一下若依项目扩展elementUI中upload自定义上传行为http-request属性<el-uploadref="upload1":limit="1"accept=".xlsx,.xls":headers="......
  • ClimaX
    摘要:当前大多数模型使用整理好的同质的数据,也就是说针对特定数据特定下游任务的。ClimaX使用跨越不同变量、空间位置、物理基础的异构数据,也就是说是一个经过自监督预训练(CMIP6)的大模型。intro:第一个问题:训练大模型要使用非常大的数据集进行与训练,NLP和CV使用了互联网规模的数据......
  • mac 使用 brew安装包报错 fatal: not in a git directory,Error: Command failed with
    在mac下使用brew安装包的时候,最后一行会报错:fatal:notinagitdirectoryError:Commandfailedwithexit128:git导致包安装不成功,解决办法:brew-v 绿色框就是提示你需要做的,输入gitconfig--global--addsafe.directory/opt/homebrew/Library/Taps/homeb......
  • mac 下使用 brew 安装包报错 error: Cannot install under Rosetta 2 in ARM default
    mac下使用brew安装包报错error:CannotinstallunderRosetta2inARMdefaultprefix(/opt/homebrew)!TorerununderARMuse:arch-arm64brewinstall...Toinstallunderx86_64,installHomebrewinto/usr/local. 解决:arch-arm64brewinstallxxx ......