Solvedant design landing ValidationError: Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.

完全根据文档做下来的,试的新建好几个项目了,还是不行。有大神指导一下什么原因吗?

报错信息如下:
Failed to compile
./src/Home/less/antMotionStyle.less (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-7-1!./node_modules/postcss-loader/src??postcss!./node_modules/less-loader/dist/cjs.js??ref--6-oneOf-7-3!./src/Home/less/antMotionStyle.less)
ValidationError: Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.

  • options has an unknown property 'source'. These properties are valid:
    object { lessOptions?, prependData?, appendData?, sourceMap? }
    This error occurred during the build time and cannot be dismissed.
    截屏2020-05-03 上午12 05 19
16 Answers

✔️Accepted Answer

temporary way to fix this problem:ant-design/ant-design#23624 😢

remove less-loader@6.0.6 and install less-loader@5.0.0 fixed on me.

插个眼同问 :(

啊我也刚看到这里。6.0刚出好像兼容方面有点问题,改成

addLessLoader({
  lessOptions: {
    javascriptEnabled: true,
    modifyVars: { '@primary-color': '#1DA57A' },
  },
}),

就好了

Other Answers:

如果使用6.x

如下配置

 {
                        loader: 'less-loader', 
                        options: {
                            lessOptions: {
                                javascriptEnabled: true
                              }
                        }
                    }

参考地址

Have the same issue, any updates?

@pitops change the less-loader version from 6.0 to 5.0, then restart it.

$ yarn remove less-loader
$ yarn add less-loader@5.0.0
$ yarn start

For the one who is using 'create-react-app' to customize the theme can check the following settings:

craco.config.js

const CracoLessPlugin = require("craco-less");

module.exports = {
  plugins: [
    {
      plugin: CracoLessPlugin,
      options: {
        lessLoaderOptions: {
          lessOptions: {
            javascriptEnabled: true,
            modifyVars: { "@primary-color": "#018a9e" },
          },
        },
      },
    },
  ],
};

package.json

{
  "dependencies": {
    "@craco/craco": "^5.6.4",
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.3.2",
    "@testing-library/user-event": "^7.1.2",
    "antd": "^4.2.5",
    "craco-less": "^1.17.0",
    "eslint-plugin-prettier": "^3.1.3",
    "lodash": "^4.17.15",
    "prettier": "^2.0.5",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-redux": "^7.2.0",
    "react-router-dom": "^5.2.0",
    "react-scripts": "3.4.1",
    "redux": "^4.0.5"
  },
}

temporary way to fix this problem:ant-design/ant-design#23624 😢

remove less-loader@6.0.0 and install less-loader@5.0.0 fixed on me.

插个眼同问 :(

Related Issues:

27
ant design landing ValidationError: Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.
temporary way to fix this problem:ant-design/ant-design#23624 😢 remove less-loader@6.0.6 and instal...
192
theme ui Syntax error: pragma and pragmaFrag cannot be set when runtime is automatic.
Just adding here in case anyone sees this error message after upgrading a project to create-react-ap...
94
server Upgrade fails with - Column name "oc_flow_operations.entity" is "NotNull", but has empty string or null as default
I just got this error while upgrading from 17.0.10 to 18.0.10 Also with me the column entity did not...
44
server Thunderbird 60.x unable to use caldav/carddav
By disabling the newly introduced parameter network.cookie.same-site.enabled the problem can be solv...
41
server Redirect loop login / Renewing session token failed
Hello I had a similar issue regarding the redirect mine was related to url overwrite protocol option...
37
bulma [Feature] SASS division without slash
I've just created a fix/divide branch Will merge and release today. This is about Bulma ...
29
materialize Changes for v1.0.0
There are some more issues I would consider to be included in v1.0.0 I think we should consider to r...
27
elementor Accordion - setting for all closed at start
Yeah not seeing a fix in 1.8.x but here's some code you should be able to copy/paste without modding...
26
bulma Importing Bulma in Create React App
For posterity's sake When importing Bulma in Create React App if you do this: You'll receive this er...
26
server Security and config warnings
Finally got this sorted as well How to use GitHub Please use the 👍 reaction to show that you are af...
23
server Syntax error or access violation: 1118 Row size too large
Changing the ROW_FORMAT to DYNAMIC did not solve the issue Steps to reproduce Run Nextcloud 16.0.0 f...
21
materialize Can't select options or scroll in select input on mobile
I found the solution! With the meta viewport like this work fine for me <meta name=viewport content=...
19
elementor 📣 Elementor v3.1 Beta 4 Release 📣
As most of the users has been hungry for performance and custom breakpoint improvement ...
18
materialize [1.0.0.alpha1] Side nav doesn't work with turbolinks 5
seem like instance still alive when turbolinks:load page it works if we destroy the existing instanc...
18
server [Nextcloud 15] Nextcloud clients cannot log in after upgrading from 15.0.0 to 15.0.2
nextcloud/android#3430 TL;DR: try adding this to your config.php: 'overwriteprotocol' => 'https', ...
18
server [Updater] Could not find resource js/config.js to load
Same issue on Nextcloud 20 PHP 7.4.3 MYSQL 8 APACHE2 Web server error logs How to use GitHub Please ...
18
blueprint First-class support for @import'ing blueprint scss files
@Ciantic It does work with the generated .css files you have to use the Webpack alias resolution ~ c...
17
materialize different colors for different toasts
In Updated Version It's something like: I would like to show the toast like Saved Successfully Pleas...
16
materialize Can't check RadioButtons or Checkbox inside input-fields div
The best solution is to not wrap the checkboxes in the .input-field class Another solution is to add...
16
server Failed Code Integrity because of EXTRA_FILE after Update from 16.0.1 to 16.0.2
Okay so for everyone getting this two things: Delete the cypress.json and the cypress folder in the ...
16
server OSX calendar sync fails (via caldav)
@dhowe I managed to get it working on High Sierra if I select the advanced profile when adding a new...
16
theme ui integrating theme-ui with storybook in a gatsby project
I managed to fix this with the below main.js storybook config As @hasparus says you can force storyb...
15
elementor data-tab link anchor to tabs
Here is my function as I could not wait :) For anyone who needs it :) Hey ...
15
elementor Add Filters and Hooks to Search Form Widget
@pako69 If you need to force Elementor's search to only use a specific post type lets say product fo...
14
elementor Popup - Close when you click on a button
@JoeDarko Currently this feature is not supported but we will look into it in the future if we see a...
14
elementor Improve performance: Reduce DOM elements
If you have concrete suggestions for reducing the number of DOM elements - we are open to hearing it...
13
MaterialDesignInXamlToolkit Could not load file or assembly 'MaterialDesignColors, Culture=neutral' or one of its dependencies
For folks still encountering this issue: this post by Carlos Anderson explains what's going on: Ther...
13
elementor How to hide some Elementor Pro widgets from the frontend editor?
@norewp - thank you The following is sample code for removing everything (for now > I suppose in the...
12
materialize Error with Meteor 1.6-rc7 and node-sass 4.5.2
Not resolved for me I also did a fresh install of Meteor 1.6.0.1 and meteor add materialize:material...
12
elementor Include custom templates in Elementor template library (Not My template)
@dinhtungdu Sure feel free to use this idea! If you want Prerequisites I have searched for similar f...
12
elementor Triggering a popup by using a class or custom JS code
@bkjproductions (and for anyone else looking for a JS only solution) you can use: In the example abo...
12
server Repair error during upgrade from 17.0.2 to 18.0.0
Had the same issue but it does not look critical.. its working.. You may do the following to ensure ...
12
server "Exception: Database error when running migration latest for app core" When Upgrading NC 20.0.11.1 -> 21.0.3
As a follow up it seems like I had to add this as an argument to my mariadb container: The argument ...
11
server Logintoken are Invalidated 21.0.1
Workaround whilst this gets fixed Explanation: It seems that the commit linked below is the only cha...
9
materialize Swipeable tabs carousel height limited to 400px
The problem is that the swipeable tabs are styled by the carousel css Reference #4148 ...
9
elementor "Edit with Elementor" sub menu item in admin bar not showing on WordPress 5.6
This works for me.. add to your site CSS: #wp-admin-bar-elementor_edit_page:hover > div { display: b...
9
elementor Elementor 1.9 - Beta Release (RC3 Updated)
v1.9 Beta Version RC3 We just released a new beta version please update your version to v1.9.0 RC3 ...
9
bulma .table-container not working on desktop
Thanks @james-wasson It is the same as mentioned above Here you go: https://jsfiddle.net/89jesr6g/7/...
9
blueprint TypeError: moment is not a function
The source of moment uses export default but the transpiled code ends up as module.exports = ... mea...
8
elementor My templates -> Display Conditions: support polylang for localisation
@ziogaschr Elementor can't guess which multilingual 3rd party plugin you are using and we don't want...
8
elementor ACF relationship field as Posts source
This was such a pain in the ass Thank you for finally solving this I'm confused as to why this isn't...
8
server An exception occurred while executing 'ALTER TABLE oc_activity_mq ADD COLUMN amq_subjectparams CLOB NOT NULL'
So maybe here a solution? Since I was there I thought let's change the table So I copied and pasted ...
7
server Files on SMB-share corrupted while up- and downloading
Same issue here with a 20.0.8.1 to 21.0.1.1 upgrade as released today I am running on Ubuntu Server ...
7
server Nextcloud 12 - Issues with Integrity Check and "X-Frame-Options"..."SAMEORIGIN"
The X-Frame-Options header has been moved to the PHP processing and outside of .htaccess so that app...
7
uswds Using "Standards" in our name establishes misleading expectations
I agree that standards can cause confusion but if possible I don't want to give up all of the benefi...
6
elementor Elementor v2.9 Beta 5 (RC3) Release 📣
We just released a new beta version please update your version to v2.9 Beta 2 =========== Beta 5 UPD...
6
elementor 📣 Elementor v3.2 Beta 4 Release 📣
The following snippet was recommended to remove eicons: Please confirm this is still applicable for ...
6
elementor Elementor Popup doesnt run with Contact Form 7
Hello @hazelnutz77 Here is a tidier and more versatile piece of code: Add this to your functions.php...
6
server Update to NC 19.0.1: Internal server error after login
List user/group combinations with non-existing group: Remove user/group combinations with non-existi...
5
elementor 🚀 Elementor v3.4 Beta 5 Release 🚀
@fabianenzensperger - thanks for your feedback We are aware about the UI problem with the global fon...