swagger-api / swagger-ui

Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
https://swagger.io
Apache License 2.0
26.59k stars 8.96k forks source link

Attempted import error: 'isNotEmpty' is not exported from 'ramda' (imported as 'isNotEmpty'). #10001

Open jme-s opened 5 months ago

jme-s commented 5 months ago

Q&A (please complete the following information)

Content & configuration

"dependencies": {
    "@agility/content-fetch": "^2.0.0",
    "@agility/content-sync": "^1.1.7",
    "@agility/nextjs": "^0.4.2",
    "@reach/dialog": "^0.18.0",
    "@svgr/webpack": "^6.3.1",
    "@tanstack/react-query": "^4.29.7",
    "axios": "^1.1.3",
    "camelize2": "^1.0.0",
    "classnames": "^2.3.1",
    "cookie": "^0.5.0",
    "crypto": "^1.0.1",
    "date-fns": "^2.29.3",
    "downshift": "^7.0.1",
    "framer-motion": "^7.2.1",
    "fs": "^0.0.1-security",
    "fs-extra": "^10.1.0",
    "libphonenumber-js": "^1.10.37",
    "lodash-es": "^4.17.21",
    "luxon": "^3.2.1",
    "next": "^13.5.6",
    "next-sitemap": "^3.1.21",
    "next-swagger-doc": "^0.4.0",
    "postcss-import": "^15.0.0",
    "postscribe": "^2.0.8",
    "prettier": "^2.7.1",
    "react": "^18.2.0",
    "react-aria": "^3.20.0",
    "react-day-picker": "^8.8.1",
    "react-device-detect": "^2.2.3",
    "react-dom": "^18.2.0",
    "react-google-recaptcha-v3": "^1.10.1",
    "react-hook-form": "^7.39.1",
    "react-html-parser": "^2.0.2",
    "react-loading-skeleton": "^3.1.0",
    "react-number-format": "^5.3.1",
    "react-slick": "^0.29.0",
    "react-use": "^17.4.0",
    "slick-carousel": "^1.8.1",
    "swagger-ui-react": "^5.17.14",
    "tailwindcss": "^3.2.2",
    "uuidv4": "^6.2.13"
  },
  "devDependencies": {
    "@babel/core": "^7.19.6",
    "@storybook/addon-actions": "^6.5.13",
    "@storybook/addon-essentials": "^6.5.13",
    "@storybook/addon-interactions": "^6.5.13",
    "@storybook/addon-links": "^6.5.13",
    "@storybook/builder-webpack5": "^6.5.13",
    "@storybook/manager-webpack5": "^6.5.13",
    "@storybook/react": "^6.5.13",
    "@storybook/testing-library": "^0.0.13",
    "@tailwindcss/typography": "^0.5.7",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/react-hooks": "^8.0.1",
    "@testing-library/user-event": "^14.4.3",
    "@trivago/prettier-plugin-sort-imports": "^3.3.0",
    "autoprefixer": "^10.4.13",
    "babel-jest": "^29.0.2",
    "babel-loader": "^8.2.5",
    "browserslist": "^4.22.2",
    "cross-env": "^7.0.3",
    "dotenv": "^16.0.2",
    "eslint": "^8.29.0",
    "eslint-config-next": "12.2.5",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-react-hooks": "^4.6.2",
    "eslint-plugin-storybook": "^0.6.7",
    "identity-obj-proxy": "^3.0.0",
    "jest": "^29.0.2",
    "jest-environment-jsdom": "^29.0.2",
    "jest-junit-reporter": "^1.1.0",
    "jest-watch-typeahead": "^2.1.1",
    "mockdate": "^3.0.5",
    "msw": "^0.47.0",
    "postcss": "^8.4.16",
    "postcss-import": "^15.0.0",
    "slugify": "^1.6.5",
    "storybook-addon-next-router": "^4.0.2"
  }

Example Swagger/OpenAPI definition: N/A

Swagger-UI configuration options: N/A

Describe the bug you're encountering

nextjs 13.5.6 - build process failure swagger-ui-react -> swagger-client -> ramda-adjunct There appears to be an error in implementation using ramda-adjunct@5 potentially with importing isNotEmpty as I am receiving the following issue on build:

Failed to compile.

./node_modules/ramda-adjunct/es/isNonEmptyArray.js
Attempted import error: 'isNotEmpty' is not exported from 'ramda' (imported as 'isNotEmpty').

Import trace for requested module:
./node_modules/ramda-adjunct/es/isNonEmptyArray.js
./node_modules/ramda-adjunct/es/index.js
./node_modules/swagger-client/es/execute/index.js
./node_modules/swagger-ui-react/swagger-ui.js
./node_modules/swagger-ui-react/index.cjs

./node_modules/ramda-adjunct/es/isNonEmptyString.js
Attempted import error: 'isNotEmpty' is not exported from 'ramda' (imported as 'isNotEmpty').

Import trace for requested module:
./node_modules/ramda-adjunct/es/isNonEmptyString.js
./node_modules/ramda-adjunct/es/index.js
./node_modules/swagger-client/es/execute/index.js
./node_modules/swagger-ui-react/swagger-ui.js
./node_modules/swagger-ui-react/index.cjs

./node_modules/ramda-adjunct/es/overlaps.js
Attempted import error: 'isNotEmpty' is not exported from 'ramda' (imported as 'isNotEmpty').

Import trace for requested module:
./node_modules/ramda-adjunct/es/overlaps.js
./node_modules/ramda-adjunct/es/index.js
./node_modules/swagger-client/es/execute/index.js
./node_modules/swagger-ui-react/swagger-ui.js
./node_modules/swagger-ui-react/index.cjs

> Build failed because of webpack errors

To reproduce...

Steps to reproduce the behavior: Npm build Next while using swagger-ui-react

Expected behavior

Imports will resolve

Screenshots

Additional context or thoughts

Tried Node 16.x.x, 18.x.x 20.x.x - all with the same issue. EDIT: Found this article you wrote @char0n https://medium.com/ramda-adjunct/chore-ramda-adjunct-v5-0-0-905ca0ae6b81

char0n commented 5 months ago

It looks like your dependency tree is corrupted or ambiguous.

I recommend to run npm dedupe or (uninstalling swagger-ui-react and installing it again)

jme-s commented 5 months ago

It looks like your dependency tree is corrupted or ambiguous.

I recommend to run npm dedupe or (uninstalling swagger-ui-react and installing it again)

Thanks for the response however both of those options yield the same issue. Have deleted package-lock and node_modules for full reinstall, then dedupe (default: hoisted) and unfortunately the exact same issue occurs.

I can reproduce this issue locally and on the pipelines which are cleaned every run.

char0n commented 5 months ago

Try inspecting the package-lock.json and see if there are multiple installations of ramda. It seems that your dep tree might contain more versions of ramda. Given that ramda still uses 0.x.y versioning scheme and they are introducing breaking changes arbitrarily it might happen. If this is the case npm overrides could be used to resolve the issue.

ezzabuzaid commented 3 months ago

Having same problem

automatyk commented 1 week ago

Is there a solution to this? I'm having the same issue. I've upgraded to the latest version. Issue persists.

char0n commented 6 days ago

Try to put this into your package.json file:

{
...
"overrides": {
  "swagger-client": {
    "ramda": "=0.30.1",
    "ramda-adjunct": "=5.1.0"
  }
}
...
}

We're pinning versions to make sure that SwaggerUI will always install the correct versions for itself independent of other dependencies in your tree.