Vue-cli 安装后运行出现问题

QQ%E6%88%AA%E5%9B%BE20190818200219

出现下面报错

$ vue-cli-service serve --mode development --dashboard

INFO Starting development server…

Starting type checking and linting service…

0% compilingUsing 1 worker with 2048MB memory limit

90% chunk assets processing ERROR Failed to compile with 2 errors8:13:19 PM

WARN
Couldn’t parse bundle asset “D:\vue\test3\dist\about.js”.
Analyzer will use module sizes from stats file.

error in ./src/components/HelloWorld.vue?vue&type=style&index=0&id=469af010&scoped=true&lang=less&

Module build failed (from ./node_modules/less-loader/dist/cjs.js):

Class constructor FileManager cannot be invoked without ‘new’
in undefined (line undefined, column undefined)

@ ./node_modules/vue-style-loader??ref–10-oneOf-1-0!./node_modules/css-loader??ref–10-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref–10-oneOf-1-2!./node_modules/less-loader/dist/cjs.js??ref–10-oneOf-1-3!./node_modules/cache-loader/dist/cjs.js??ref–0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/HelloWorld.vue?vue&type=style&index=0&id=469af010&scoped=true&lang=less& 4:14-465 14:3-18:5 15:22-473
@ ./src/components/HelloWorld.vue?vue&type=style&index=0&id=469af010&scoped=true&lang=less&
@ ./src/components/HelloWorld.vue
@ ./node_modules/cache-loader/dist/cjs.js??ref–13-0!./node_modules/babel-loader/lib!./node_modules/ts-loader??ref–13-2!./node_modules/cache-loader/dist/cjs.js??ref–0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/Home.vue?vue&type=script&lang=ts&
@ ./src/views/Home.vue?vue&type=script&lang=ts&
@ ./src/views/Home.vue
@ ./src/router.ts
@ ./src/main.ts
@ multi (webpack)-dev-server/client?http://192.168.1.103:17676/sockjs-node (webpack)/hot/dev-server.js ./src/main.ts

error in ./src/App.vue?vue&type=style&index=0&lang=less&

Module build failed (from ./node_modules/less-loader/dist/cjs.js):

Class constructor FileManager cannot be invoked without ‘new’
in undefined (line undefined, column undefined)

@ ./node_modules/vue-style-loader??ref–10-oneOf-1-0!./node_modules/css-loader??ref–10-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref–10-oneOf-1-2!./node_modules/less-loader/dist/cjs.js??ref–10-oneOf-1-3!./node_modules/cache-loader/dist/cjs.js??ref–0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=style&index=0&lang=less& 4:14-416 14:3-18:5 15:22-424
@ ./src/App.vue?vue&type=style&index=0&lang=less&
@ ./src/App.vue
@ ./src/main.ts
@ multi (webpack)-dev-server/client?http://192.168.1.103:17676/sockjs-node (webpack)/hot/dev-server.js ./src/main.ts

No type errors found
No lint errors found
Version: typescript 3.5.3, tslint 5.18.0
Time: 11049ms

Total task duration: 71.28s
$ vue-cli-service serve --mode development --dashboard
INFO Starting development server…

Starting type checking and linting service…

0% compilingUsing 1 worker with 2048MB memory limit

ERROR Failed to compile with 2 errors8:14:30 PM

error in ./src/App.vue?vue&type=style&index=0&lang=less&

Module build failed (from ./node_modules/less-loader/dist/cjs.js):

Class constructor FileManager cannot be invoked without ‘new’
in undefined (line undefined, column undefined)

@ ./node_modules/vue-style-loader??ref–10-oneOf-1-0!./node_modules/css-loader??ref–10-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref–10-oneOf-1-2!./node_modules/less-loader/dist/cjs.js??ref–10-oneOf-1-3!./node_modules/cache-loader/dist/cjs.js??ref–0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=style&index=0&lang=less& 4:14-416 14:3-18:5 15:22-424
@ ./src/App.vue?vue&type=style&index=0&lang=less&
@ ./src/App.vue
@ ./src/main.ts
@ multi (webpack)-dev-server/client?http://192.168.1.103:25719/sockjs-node (webpack)/hot/dev-server.js ./src/main.ts

error in ./src/components/HelloWorld.vue?vue&type=style&index=0&id=469af010&scoped=true&lang=less&

Module build failed (from ./node_modules/less-loader/dist/cjs.js):

Class constructor FileManager cannot be invoked without ‘new’
in undefined (line undefined, column undefined)

@ ./node_modules/vue-style-loader??ref–10-oneOf-1-0!./node_modules/css-loader??ref–10-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref–10-oneOf-1-2!./node_modules/less-loader/dist/cjs.js??ref–10-oneOf-1-3!./node_modules/cache-loader/dist/cjs.js??ref–0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/HelloWorld.vue?vue&type=style&index=0&id=469af010&scoped=true&lang=less& 4:14-465 14:3-18:5 15:22-473
@ ./src/components/HelloWorld.vue?vue&type=style&index=0&id=469af010&scoped=true&lang=less&
@ ./src/components/HelloWorld.vue
@ ./node_modules/cache-loader/dist/cjs.js??ref–13-0!./node_modules/babel-loader/lib!./node_modules/ts-loader??ref–13-2!./node_modules/cache-loader/dist/cjs.js??ref–0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/Home.vue?vue&type=script&lang=ts&
@ ./src/views/Home.vue?vue&type=script&lang=ts&
@ ./src/views/Home.vue
@ ./src/router.ts
@ ./src/main.ts
@ multi (webpack)-dev-server/client?http://192.168.1.103:25719/sockjs-node (webpack)/hot/dev-server.js ./src/main.ts

Type checking and linting in progress…

WARN
Couldn’t parse bundle asset “D:\vue\test3\dist\about.js”.
Analyzer will use module sizes from stats file.

No type errors found

No lint errors found
Version: typescript 3.5.3, tslint 5.18.0
Time: 7312ms

这种报错是我什么东西没安装吗??我创建项目后,直接运行,出的错

有结果了吗?我今天也遇到这个问题了

这是因为 less 更新导致的,建议改到3.10.0以前

我已将发现问题了,就如这位朋友所说得,less导致出现得问题


这位朋友回的帖子
我多次创建项目试出来,发现选择css预处理后,如果选择less得话就会出现这种问题,其他几个都不会出现这个错误,所以有可能是less更新导致,改到3.10.0之前得我没测试,所以不确定,既然这位朋友说了,估计应该可以的

看新回复,就可以了 Vue-cli 安装后运行出现问题

谢谢,应该是less问题,其他css预处理器都好使,就使用less时会出现此错误

我也发现了,是less的问题,改成低版本就可以,

less-loader: ^5.0.0 就可以了

1 Like

感谢,的确到达5.0.0版本就会没有错误