js&ts_webpack错误

首先卸载原来的webpack包:npm uninstall webpack
然后重新再项目中安装低版本的:npm install webpack@^4.0.0 --save-dev

我自己的盲区小tips:
–save : dependencies 键下,发布后还需要依赖的模块.
–save-dev : devDependencies 键下,仅在开发时依赖的模块

image

indows PowerShell
版权所有 (C) Microsoft Corporation。保留所有权利。

尝试新的跨平台 PowerShell https://aka.ms/pscore6

PS D:\VS code-file\vue-typescript> npm run serve
Debugger attached.

> vue-typescript-admin-template@1.0.0 serve D:\VS code-file\vue-typescript
> concurrently "npm:mock" "vue-cli-service serve"

Debugger attached.
[1] Debugger attached.
[mock] Debugger attached.
[1]  INFO  Starting development server...
[mock]
[mock] > vue-typescript-admin-template@1.0.0 mock D:\VS code-file\vue-typescript
[mock] > cd mock && ts-node-dev mock-server.ts
[mock]
[mock] Debugger attached.
[mock] [INFO] 20:04:51 ts-node-dev ver. 1.1.8 (using ts-node ver. 9.1.1, typescript ver. 4.2.3)
[mock] Debugger attached.
[1]  ERROR  Error: Rule can only have one resource source (provided resource and test + include + exclude) in {
[1]   "exclude": [
[1]     null
[1]   ],
[1]   "use": [
[1]     {
[1]       "loader": "D:\\VS code-file\\vue-typescript\\node_modules\\cache-loader\\dist\\cjs.js",
[1]       "options": {
[1]         "cacheDirectory": "D:\\VS code-file\\vue-typescript\\node_modules\\.cache\\babel-loader",
[1]         "cacheIdentifier": "5694cd12"
[1]       },
[1]       "ident": "clonedRuleSet-38[0].rules[0].use[0]"
[1]     },
[1]     {
[1]       "loader": "D:\\VS code-file\\vue-typescript\\node_modules\\babel-loader\\lib\\index.js",
[1]       "options": "undefined",
[1]       "ident": "undefined"
[1]     }
[1]   ]
[1] }
[1] Error: Rule can only have one resource source (provided resource and test + include + exclude) in {
[1]   "exclude": [
[1]     null
[1]   ],
[1]   "use": [
[1]     {
[1]       "loader": "D:\\VS code-file\\vue-typescript\\node_modules\\cache-loader\\dist\\cjs.js",
[1]       "options": {
[1]         "cacheDirectory": "D:\\VS code-file\\vue-typescript\\node_modules\\.cache\\babel-loader",
[1]         "cacheIdentifier": "5694cd12"
[1]       },
[1]       "ident": "clonedRuleSet-38[0].rules[0].use[0]"
[1]     },
[1]     {
[1]       "loader": "D:\\VS code-file\\vue-typescript\\node_modules\\babel-loader\\lib\\index.js",
[1]       "options": "undefined",
[1]       "ident": "undefined"
[1]     }
[1]   ]
[1] }
[1]     at checkResourceSource (D:\VS code-file\vue-typescript\node_modules\@vue\cli-service\node_modules\webpack\lib\RuleSet.js:167:11)
[1]     at Function.normalizeRule (D:\VS code-file\vue-typescript\node_modules\@vue\cli-service\node_modules\webpack\lib\RuleSet.js:198:4)       
[1]     at D:\VS code-file\vue-typescript\node_modules\@vue\cli-service\node_modules\webpack\lib\RuleSet.js:110:20
[1]     at Array.map (<anonymous>)
[1]     at Function.normalizeRules (D:\VS code-file\vue-typescript\node_modules\@vue\cli-service\node_modules\webpack\lib\RuleSet.js:109:17)     
[1]     at new RuleSet (D:\VS code-file\vue-typescript\node_modules\@vue\cli-service\node_modules\webpack\lib\RuleSet.js:104:24)
[1]     at new NormalModuleFactory (D:\VS code-file\vue-typescript\node_modules\@vue\cli-service\node_modules\webpack\lib\NormalModuleFactory.js:115:18)
[1]     at Compiler.createNormalModuleFactory (D:\VS code-file\vue-typescript\node_modules\@vue\cli-service\node_modules\webpack\lib\Compiler.js:636:31)
[1]     at Compiler.newCompilationParams (D:\VS code-file\vue-typescript\node_modules\@vue\cli-service\node_modules\webpack\lib\Compiler.js:653:30)
[1]     at Compiler.compile (D:\VS code-file\vue-typescript\node_modules\@vue\cli-service\node_modules\webpack\lib\Compiler.js:661:23)
[1]     at D:\VS code-file\vue-typescript\node_modules\@vue\cli-service\node_modules\webpack\lib\Watching.js:77:18
[1]     at _next0 (eval at create (D:\VS code-file\vue-typescript\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:25:1)
[1]     at eval (eval at create (D:\VS code-file\vue-typescript\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:34:1)
[1]     at watchRun (D:\VS code-file\vue-typescript\node_modules\fork-ts-checker-webpack-plugin\lib\index.js:252:13)
[1]     at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\VS code-file\vue-typescript\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:30:1)
[1]     at AsyncSeriesHook.lazyCompileHook (D:\VS code-file\vue-typescript\node_modules\tapable\lib\Hook.js:154:20)
[1] Waiting for the debugger to disconnect...
[1] vue-cli-service serve exited with code 1
posted @ 2021-08-03 20:23  青砖黛瓦  阅读(196)  评论(0编辑  收藏  举报