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
- :lock: lock less to 3.9.0 https://github.com/less/less.js/issues/3416 https://github.com/less/less.js/issues/3414 — committed to ant-design/ant-design by afc163 5 years ago
- fix: Cascader notFoundContent width (#18325) * :bug: Fix Cascader notFoundContent width close #18176 * :lock: lock less to 3.9.0 https://github.com/less/less.js/issues/3416 https://github.c... — committed to ant-design/ant-design by afc163 5 years ago
- :up: revert locking less https://github.com/less/less.js/issues/3414 https://github.com/less/less.js/issues/3416 — committed to ant-design/ant-design by afc163 5 years ago
- :up: revert locking less (#18331) https://github.com/less/less.js/issues/3414 https://github.com/less/less.js/issues/3416 — committed to ant-design/ant-design by afc163 5 years ago
- package.json: Bump version of less-loader See https://github.com/less/less.js/issues/3414 — committed to marusak/cockpit-ostree by marusak 5 years ago
- package.json: Bump up version on less-loader See https://github.com/less/less.js/issues/3414 — committed to marusak/cockpit-podman by marusak 5 years ago
- package.json: Bump version of less-loader See https://github.com/less/less.js/issues/3414 Closes #25 — committed to cockpit-project/cockpit-ostree by marusak 5 years ago
- package.json: Bump up version on less-loader See https://github.com/less/less.js/issues/3414 Closes #184 — committed to cockpit-project/cockpit-podman by marusak 5 years ago
- 项目初始化:https://github.com/less/less.js/issues/3414#issuecomment-522223041 — committed to nbin2008/bbs-front by nbin2008 5 years ago
- package.json(gatsby-plugin-less): Bump up version on less-loader see https://github.com/less/less.js/issues/3414 https://github.com/cockpit-project/cockpit-podman/pull/184 — committed to wangyi7099/gatsby by wangyi7099 5 years ago
- build: downgrade to less@3.9.0 With less@3.10+, our less files won't compile using less-loader. Known issue: https://github.com/less/less.js/issues/3414 — committed to ovh/manager by deleted user 5 years ago
- cockpit: Use less-loader 5.0.0 or later See less/less.js#3414 — committed to mvollmer/subscription-manager by mvollmer 5 years ago
- cockpit: Use less-loader 5.0.0 or later See less/less.js#3414 — committed to mvollmer/subscription-manager by mvollmer 5 years ago
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:Manually specify less version : npm i less@3.9.0 -D
ok!!!
你可以,把你package.js 里的less依赖,重新安装最近小版本依赖。
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
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 withoutnew
. A FileManager is supposed to always be invoked withnew
(that’s the documented API), and older versions ofless-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?