Vue-cli-service-build报错,求助大佬!!

vue-cli-service-build报错No module factory available for dependency type: CssDependency

下面是系统报错

ERROR  Error: No module factory available for dependency type: CssDependency
Error: No module factory available for dependency type: CssDependency
    at addDependency (E:\Games\hitokoto\node_modules\webpack\lib\Compilation.js:800:12)
    at iterationOfArrayCallback (E:\Games\hitokoto\node_modules\webpack\lib\Compilation.js:208:3)
    at addDependenciesBlock (E:\Games\hitokoto\node_modules\webpack\lib\Compilation.js:816:5)
    at Compilation.processModuleDependencies (E:\Games\hitokoto\node_modules\webpack\lib\Compilation.js:827:4)
    at afterBuild (E:\Games\hitokoto\node_modules\webpack\lib\Compilation.js:954:15)
    at buildModule.err (E:\Games\hitokoto\node_modules\webpack\lib\Compilation.js:998:11)
    at callback (E:\Games\hitokoto\node_modules\webpack\lib\Compilation.js:734:5)
    at module.build.error (E:\Games\hitokoto\node_modules\webpack\lib\Compilation.js:782:12)
    at handleParseResult (E:\Games\hitokoto\node_modules\webpack\lib\NormalModule.js:478:12)
    at doBuild.err (E:\Games\hitokoto\node_modules\webpack\lib\NormalModule.js:500:6)
    at runLoaders (E:\Games\hitokoto\node_modules\webpack\lib\NormalModule.js:358:12)
    at E:\Games\hitokoto\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (E:\Games\hitokoto\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at E:\Games\hitokoto\node_modules\loader-runner\lib\LoaderRunner.js:186:6
    at context.callback (E:\Games\hitokoto\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
    at childCompiler.runAsChild (E:\Games\Hitokoto\node_modules\mini-css-extract-plugin\dist\loader.js:198:12)
    at compile (E:\Games\hitokoto\node_modules\webpack\lib\Compiler.js:343:11)
    at hooks.afterCompile.callAsync.err (E:\Games\hitokoto\node_modules\webpack\lib\Compiler.js:681:15)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\Games\hitokoto\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (E:\Games\hitokoto\node_modules\tapable\lib\Hook.js:154:20)
    at compilation.seal.err (E:\Games\hitokoto\node_modules\webpack\lib\Compiler.js:678:31)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\Games\hitokoto\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
E:\Games\hitokoto\node_modules\neo-async\async.js:16
    throw new Error('Callback was already called.');
    ^

Error: Callback was already called.
    at throwError (E:\Games\hitokoto\node_modules\neo-async\async.js:16:11)
    at E:\Games\hitokoto\node_modules\neo-async\async.js:2818:7
    at process._tickCallback (internal/process/next_tick.js:61:11)

下面这个是我的package.json

{
“name”: “hitokoto”,
“version”: “0.1.0”,
“private”: true,
“scripts”: {
“serve”: “vue-cli-service serve”,
“build”: “vue-cli-service build”,
“lint”: “vue-cli-service lint”
},
“dependencies”: {
“core-js”: “^3.4.4”,
“jquery”: “^3.4.1”,
“jquery-ui”: “^1.12.1”,
“vue”: “^2.6.10”,
“vue-router”: “^3.1.3”
},
“devDependencies”: {
@vue/cli-plugin-babel”: “^4.1.0”,
@vue/cli-plugin-eslint”: “^4.1.0”,
@vue/cli-plugin-router”: “^4.1.0”,
@vue/cli-service”: “^4.1.0”,
@vue/eslint-config-prettier”: “^5.0.0”,
“babel-eslint”: “^10.0.3”,
“eslint”: “^5.16.0”,
“eslint-plugin-prettier”: “^3.1.1”,
“eslint-plugin-vue”: “^5.0.0”,
“prettier”: “^1.19.1”,
“stylus”: “^0.54.7”,
“stylus-loader”: “^3.0.2”,
“vue-template-compiler”: “^2.6.10”
}
}

删掉lock文件重新安装依赖试试

在vue.config.js文件中配置
module.exports = {
css: {
extract: false
}
}

原因看下面
https://cli.vuejs.org/config/#css-extract
https://segmentfault.com/a/1190000016390112

1 Like