vue-cli: Unable to npm run build on new project
Version
4.1.2
Environment info
Environment Info:
System:
OS: Windows 10 10.0.17134
CPU: (8) x64 Intel(R) Xeon(R) CPU E3-1505M v5 @ 2.80GHz
Binaries:
Node: 10.16.2 - C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 42.17134.1098.0
npmPackages:
@vue/babel-helper-vue-jsx-merge-props: 1.0.0
@vue/babel-plugin-transform-vue-jsx: 1.1.2
@vue/babel-preset-app: 4.1.2
@vue/babel-preset-jsx: 1.1.2
@vue/babel-sugar-functional-vue: 1.1.2
@vue/babel-sugar-inject-h: 1.1.2
@vue/babel-sugar-v-model: 1.1.2
@vue/babel-sugar-v-on: 1.1.2
@vue/cli-overlay: 4.1.2
@vue/cli-plugin-babel: ^4.1.0 => 4.1.2
@vue/cli-plugin-eslint: ^4.1.0 => 4.1.2
@vue/cli-plugin-router: 4.1.2
@vue/cli-plugin-vuex: 4.1.2
@vue/cli-service: ^4.1.0 => 4.1.2
@vue/cli-shared-utils: 4.1.2
@vue/component-compiler-utils: 3.1.0
@vue/preload-webpack-plugin: 1.1.1
@vue/web-component-wrapper: 1.2.0
eslint-plugin-vue: ^5.0.0 => 5.2.3
vue: ^2.6.10 => 2.6.11
vue-eslint-parser: 5.0.0
vue-hot-reload-api: 2.3.4
vue-loader: 15.8.3
vue-style-loader: 4.1.2
vue-template-compiler: ^2.6.10 => 2.6.11
vue-template-es2015-compiler: 1.9.1
npmGlobalPackages:
@vue/cli: Not Found
Steps to reproduce
PS C:\code> vue create -d repro
PS C:\code> cd repro
PS C:\code\repro> npm run build
What is expected?
npm run build works out of the box
What is actually happening?
PS C:\code\repro> npm run build
> repro@0.1.0 build C:\code\repro
> vue-cli-service build
ERROR Error: No module factory available for dependency type: CssDependency
Error: No module factory available for dependency type: CssDependency
at addDependency (C:\Code\repro\node_modules\webpack\lib\Compilation.js:800:12)
at iterationOfArrayCallback (C:\Code\repro\node_modules\webpack\lib\Compilation.js:208:3)
at addDependenciesBlock (C:\Code\repro\node_modules\webpack\lib\Compilation.js:816:5)
at Compilation.processModuleDependencies (C:\Code\repro\node_modules\webpack\lib\Compilation.js:827:4)
at afterBuild (C:\Code\repro\node_modules\webpack\lib\Compilation.js:954:15)
at buildModule.err (C:\Code\repro\node_modules\webpack\lib\Compilation.js:998:11)
at callback (C:\Code\repro\node_modules\webpack\lib\Compilation.js:734:5)
at module.build.error (C:\Code\repro\node_modules\webpack\lib\Compilation.js:782:12)
at handleParseResult (C:\Code\repro\node_modules\webpack\lib\NormalModule.js:478:12)
at doBuild.err (C:\Code\repro\node_modules\webpack\lib\NormalModule.js:500:6)
at runLoaders (C:\Code\repro\node_modules\webpack\lib\NormalModule.js:358:12)
at C:\Code\repro\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (C:\Code\repro\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at C:\Code\repro\node_modules\loader-runner\lib\LoaderRunner.js:186:6
at context.callback (C:\Code\repro\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
at childCompiler.runAsChild (C:\code\repro\node_modules\mini-css-extract-plugin\dist\loader.js:198:12)
at compile (C:\Code\repro\node_modules\webpack\lib\Compiler.js:343:11)
at hooks.afterCompile.callAsync.err (C:\Code\repro\node_modules\webpack\lib\Compiler.js:681:15)
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Code\repro\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:15:1)
at AsyncSeriesHook.lazyCompileHook (C:\Code\repro\node_modules\tapable\lib\Hook.js:154:20)
at compilation.seal.err (C:\Code\repro\node_modules\webpack\lib\Compiler.js:678:31)
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Code\repro\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! repro@0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the repro@0.1.0 build 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\ddreier\AppData\Roaming\npm-cache\_logs\2020-01-02T22_36_06_103Z-debug.log
Running npm run serve works, and running vue build from the src directory also works.
I’m not sure why vue info says “@vue/cli: Not Found” when it clearly is installed. Before opening this issue I ran npm uninstall -g @vue/cli and npm install -g @vue/cli.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 24 (8 by maintainers)
Looks like webpack fails to load some loader/plugin when executed in PowerShell. I’m not familiar with PowerShell but you can check for the path cases…
I noticed that in the PS prompts it’s
C:\codewhile in cmd it’sC:\Code. Maybe that’s the problem.@douglasg14b the solution for me was to make sure that the path casing in my terminal matched the actual path casing in the filesystem (on Windows).
Might be a different issue if your casing already matches.
Wow, I didn’t find that MS Tech Community thread when I was trying to search around.
And what do you know, I did
npm run buildin a Cmd instead of PowerShell and it works. That’s bizarre.I googled the error message and the only reports I got are these:
https://github.com/vuejs/vue-cli/issues/5030 https://techcommunity.microsoft.com/t5/windows-dev-appconsult/how-to-integrate-vue-js-and-asp-net-core-using-spa-extension/bc-p/1081095/highlight/true#M209
So it’s a very rare issue.
I noticed that all of the 3 cases are running on Windows (and maybe PowerShell). Could you try to use a different terminal for the same command?
Cmdfor example.