npm dependency issue with datatables.net-responsive and datatables.net-select

npm dependency issue with datatables.net-responsive and datatables.net-select

bturgeonbturgeon Posts: 3Questions: 0Answers: 0

In trying to run npm install today, we encountered some errors. It seems the dependencies specified in package.json on datatables.net-responsive (version 2.5.0) and datatables.net-select (version 1.7.0) is "datatables.net": ">=1.13.4" and is therefore now pulling in datatables.net 2.0 which is incompatible.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Thank you for flagging this up and apologies for the errors. I'll need to do a patch release of the older versions of these plugins to tighten up their dependency versions. Unfortunately, that isn't as simple as npm publish since I need to account for the CDN, Nuget and all of that, but I think that is an important point to fix.

    Until I can do that, specify a specific version of DataTables - 1.13.10 is the latest in the 1.x series:

    npm install datatables.net@1.13.10
    

    Allan

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Out of interest, can you show me the DataTables dependencies of your package.json file? Have you specified a specific version of Select or Responsive, but not DataTables? I'm wondering why DataTables would have updated, but not the other components.

    Allan

  • bturgeonbturgeon Posts: 3Questions: 0Answers: 0

    Hi Allan,

    The dependencies in our package.json are:

    "datatables.net": "1.13.4",
        "datatables.net-bs4": "1.12.1",
        "datatables.net-buttons-bs4": "1.7.1",
        "datatables.net-colreorder": "1.5.6",
        "datatables.net-responsive-bs4": "2.3.0",
        "datatables.net-rowreorder-bs4": "1.2.8",
        "datatables.net-select-bs4": "1.4.0"
    

    "datatables.net-select-bs4" was causing "datatables.net-select" v1.7.0 to get included, and within that package in node_modules was it's own node_modules folder containing datatables v.2.0 since it's dependencies listed
    "datatables.net": ">=1.13.4"

    In case anyone else encounters this, we were able to fix the build in our set up with the following in package.json

    "overrides": {
        "datatables.net-responsive-bs4": {
          "datatables.net-responsive": "^2.2.9"
        },
        "datatables.net-responsive": {
          "datatables.net": "^1.13.4"
        },
        "datatables.net-select-bs4": {
          "datatables.net-select": "^1.3.3"
        },
        "datatables.net-select": {
          "datatables.net": "^1.13.4"
        }
      },
    
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Ah! You aren't doing a flat node_modules structure. Thank you for the clarification and also for posting the workaround! Hopefully there won't be many hit by this error. I know now how to tighten up my dependency versions. Apologies again!

    Allan

  • bturgeonbturgeon Posts: 3Questions: 0Answers: 0

    All good. Thanks for the quick response!

  • bowbow Posts: 9Questions: 1Answers: 0
    edited July 31

    I must say that a week ago I met this dependency problem. In short, these code doesn't work any more. I've added "overrides" (which I was not aware of before )) but it didn't help. As soon as I include datatables-select 2.0.3 it pulls fresh datatables-net "2.1.2" out of nowhere :)

    dependencies":      {
        "datatables.net":        "2.0.8",
        "datatables.net-select": "2.0.3"
    },
    "overrides":         {
        "datatables.net-select": { "datatables.net": "2.0.8" },
        "datatables.net": {"datatables.net-select": "2.0.3"}
    },
    

    So I reverted "-select" to even older version, and it works

    dependencies":      {
        "datatables.net":        "2.0.8",
        "datatables.net-select": "1.7.1"
    
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    datatables-net-select (current release is 2.0.3) has a dependency on datatables.net ^2 - i.e. any v2 version. There was an error where Select 1.x used to have a dependency on >1.11 (resulting in any new version), but that was resolved with Select 2.

    If I try your dependencies:

    {
      "name": "select-test",
      "version": "1.0.0",
      "main": "index.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "keywords": [],
      "author": "",
      "license": "ISC",
      "description": "",
      "dependencies": {
        "datatables.net":        "2.0.8",
        "datatables.net-select": "2.0.3"
      }
    }
    

    And npm install that - I get DataTables 2.0.8 and Select 2.0.3. Not DataTables 2.1.2.

    Can you create a package.json that shows the issue please?

    Thanks,
    Allan

  • bowbow Posts: 9Questions: 1Answers: 0

    Don't know how it happens. I've sent actual package.json but seems it waits for you adoption.

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    edited August 1

    Where did you sent it? You could paste it in, or attach it here.

    Allan

  • bowbow Posts: 9Questions: 1Answers: 0

    I pasted it here, but after some editing the forum engine said "the message is need to be checked by the admin" :)

    {
        "name":              "abcdefgh",
        "version":           "1.0.0",
        "main":              "index.js",
        "license":           "MIT",
        "dependencies":      {
            "air-datepicker":        "^3.5.3",
            "bootstrap":             "^4.6.2",
            "bootstrap-toggle":      "^2.2.2",
            "bootstrap-select":      "^1.13.18",
            "slim-select":           "^2.8.2",
            "jquery":                "^3.7.1",
            "jquery.cookie":         "^1.4.1",
            "dayjs":                 "^2.0.0-alpha.4",
            "dayjs-ext":             "^2.2.0",
            "popper.js":             "^1.16.1",
            "webrtc-adapter":        "^9.0.1",
            "sip.js":                "^0.21.2",
            "datatables.net":        "2.0.8",
            "datatables.net-select": "2.0.3"
        },
        "overrides":         {
            "datatables.net-select": {
                "datatables.net": "2.0.3"
            },
            "datatables.net":        {
                "datatables.net-select": "2.0.8"
            }
        },
        "scripts":           {
            "build": "webpack --config webpack.config.js",
            "test":  "jest"
        },
        "jest-junit":        {
            "outputName": "build/test-results/test/junit.xml"
        },
        "//devDependencies": {"webpack-bundle-analyzer": ""},
        "//devDependencies": {"css-loader": "2.1.1 — the latest of small size"},
        "devDependencies":   {
            "@fortawesome/fontawesome-free": "^5.15.4",
            "@types/jest":                   "^24.0.18",
            "@types/jquery":                 "^3.5.30",
            "@types/jquery.cookie":          "^1.4.35",
            "@types/bootstrap":              "^4.6.6",
            "@types/bootstrap-toggle":       "^2.2.5",
            "@types/bootstrap-select":       "^1.13.7",
            "@types/webrtc":                 "^0.0.43",
            "@types/sharedworker":           "^0.0.114",
            "css-loader":                    "^2.1.1",
            "style-loader":                  "^3.3.3",
            "html-loader":                   "^0.5.5",
            "html-webpack-plugin":           "^5.5.1",
            "html-webpack-template":         "^6.2.0",
            "ts-loader":                     "^4.5.0",
            "ts-jest":                       "^26.5.6",
            "jest":                          "^26.6.3",
            "jest-junit":                    "^16.0.0",
            "identity-obj-proxy":            "^3.0.0",
            "typescript":                    "^5.6.0-beta",
            "webpack":                       "^5.93.0",
            "webpack-cli":                   "^5.1.4"
        }
    }
    
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    That gives me:

    $ npm install
    npm error code ERESOLVE
    npm error ERESOLVE unable to resolve dependency tree
    npm error
    npm error While resolving: abcdefgh@1.0.0
    npm error Found: webpack@5.93.0
    npm error node_modules/webpack
    npm error   dev webpack@"^5.93.0" from the root project
    npm error
    npm error Could not resolve dependency:
    npm error peer webpack@"^4.0.0" from css-loader@2.1.1
    npm error node_modules/css-loader
    npm error   dev css-loader@"^2.1.1" from the root project
    

    Allan

  • bowbow Posts: 9Questions: 1Answers: 0

    Yeah, probably you've enabled some strict settings.
    Which version of Node.js and NPM do you have, by the way?

  • bowbow Posts: 9Questions: 1Answers: 0

    I must admit that after releasing Datatables 2.1.3 most problems with the new version 2.1 are gone. So now I'm stopping to struggle with dependencies, thanks for answering!

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    $ npm --version
    10.7.0
    $ node --version
    v20.15.1
    

    Good to hear that 2.1.3 appears to help though!

    Allan

Sign In or Register to comment.