less.js: Class constructor FileManager cannot be invoked without 'new'.

It seems that v3.10.0 breaks my build, webpack logs below:

ERROR in ./src/pages/score/components/current/no-join/index.less
Module build failed (from ./node_modules/_mini-css-extract-plugin@0.5.0@mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/_less-loader@4.1.0@less-loader/dist/cjs.js):


Class constructor FileManager cannot be invoked without 'new'
      in undefined (line undefined, column undefined)
    at runLoaders (/home/admin/build/node_modules/_webpack@4.39.2@webpack/lib/NormalModule.js:313:20)
    at /home/admin/build/node_modules/_loader-runner@2.4.0@loader-runner/lib/LoaderRunner.js:367:11
    at /home/admin/build/node_modules/_loader-runner@2.4.0@loader-runner/lib/LoaderRunner.js:233:18
    at context.callback (/home/admin/build/node_modules/_loader-runner@2.4.0@loader-runner/lib/LoaderRunner.js:111:13)

Everything is ok when downgrade to v3.9.0, please investigate this issue and hope to fix it as soon as possible.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 52
  • Comments: 64 (7 by maintainers)

Commits related to this issue

Most upvoted comments

I have the same problem,you mast change you ‘package.json’ => “less”: “~3.9.0”, limit version

可以把package.json中 less版本的 ^ 去掉 重新安装一下 v3.9.0 应该就可以解决问题 大家可以试一下
虽然 锁定了版本 但是由于 ^, 所以会下载3 一下的最新版本, 最新版本应该是有问题的。

just use less-loader@5.0.0 every thing will be ok

This is an issue with an older version of less-loader, not Less, which did not inherit the Less filemanager correctly. less-loader 5.0 does. See: https://github.com/less/less.js/issues/3414#issuecomment-522223041

@montanaflynn you can also fix the problem by specifying a sub version for less-loader temporarily:

devDepedencies: {
    "less-loader": "4.1.0",
    "less": "3.9.0"
}

Manually specify less version : npm i less@3.9.0 -D
ok!!!

解决了吗?

你可以,把你package.js 里的less依赖,重新安装最近小版本依赖。 image

use "less": "~3.9.0"

Same here. npm picks up this “minor” release automatically, and breaks all of my builds. 😦

+1 version less 3.9.0 less-loader 4.1.0

@ezgitek

npm i @zeit/next-less
npm i less@3.9.0

Incidentally, for those watching this thread, I’ll re-open and probably submit a fix later today for older less-loader versions, just to have things be less annoying.

It’s one of those edge cases where actually using the Class syntax to replace a prototype function throws an error without new. A FileManager is supposed to always be invoked with new (that’s the documented API), and older versions of less-loader apparently did not.

Again, though, if you’re looking at the thread, just updating to less-loader 5.0 fixes this incompatibility.

It’s not a node version issue.

Why does this problem arise? Node.js version is not right?