Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install react-admin 3.10.1 but get ra-core latest 3.13.0 #5979

Closed
hieusmiths opened this issue Mar 2, 2021 · 6 comments · Fixed by #5989
Closed

Install react-admin 3.10.1 but get ra-core latest 3.13.0 #5979

hieusmiths opened this issue Mar 2, 2021 · 6 comments · Fixed by #5989
Assignees
Labels

Comments

@hieusmiths
Copy link
Contributor

What you were expecting:
Has no exported member 'TestContext'. Did you mean 'ListContext'
What happened instead:

Steps to reproduce:

  • Delete node_modules
  • Yarn install

Package.json
"react-admin": "3.10.1"

Related code:

import { TestContext } from "react-admin";

Other information:

Environment

  • React-admin version: 3.10.1
  • Last version that did not exhibit the issue (if applicable):
  • React version: 16.13.1
  • Browser: chrome
  • Stack trace (in case of a JS error):
@fzaninotto
Copy link
Member

Hi, and thanks for your issue. I don't understand where your bug occurs. If you're importing TestContext in your code, then the 3.13 release notes explain what you need to do.

If the bug occurs without you importing TestContext manually, can you please link to a CodeSandbox reproducing it?

@fzaninotto
Copy link
Member

Also, you can lock the 'ra-core' version to 3.10.1 using resolutions in your packages.json to avoid the problem.

@djhi
Copy link
Collaborator

djhi commented Mar 2, 2021

You probably don't need resolutions and just add a dependency to the version of ra-core you want in your project

@danjebs
Copy link

danjebs commented Mar 3, 2021

Not a complete reproduction, but hopefully more information to help clarify the issue.

I had a working react-admin a week ago, took a holiday and came back to find Docker spinning up the admin (on dev):

  1. Initially with all resources using their i18n IDs instead of names, and nothing loading
  2. After re-building, receiving the error ./node_modules/ra-ui-materialui/esm/input/ReferenceArrayInput.js Attempted import error: 'ReferenceArrayInputContextProvider' is not exported from 'ra-core'.

This was the package.json file:

{
  "name": "morpheus",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev -p 5000",
    "build": "next build",
    "start": "next start -p 5000"
  },
  "dependencies": {
    "@apollo/client": "^3.0.2",
    "@ckeditor/ckeditor5-react": "^3.0.0",
    "@rails/activestorage": "^6.0.3-2",
    "graphql": "^15.3.0",
    "lodash": "^4.17.16",
    "next": "10.0.1",
    "query-string": "^6.13.1",
    "ra-core": "3.12.5",
    "ra-data-graphql": "^3.6.1",
    "ra-data-graphql-simple": "^3.6.1",
    "ra-data-json-server": "^3.7.0",
    "react": "^16.13.1",
    "react-admin": "3.10.4",
    "react-beautiful-dnd": "^13.0.0",
    "react-dom": "^16.13.1",
    "trix": "^1.2.4",
    "util": "^0.12.3"
  }
}

I then bumped both react-admin and ra-core to 3.13.1 and re-built the project and it works again.

So issue solved - but it's happened a few times that, without changing anything in package.json, the admin breaks. Previously when deploying a working dev project to stage (stage broke, then dev broke afterwards when I re-built dev). Fortunately not yet when deploying to prod.

I realise that the description above is not a specific issue with a specific version. And perhaps it's also frustrating for you when people who aren't so familiar with NPM versioning settings are reporting what seems like a basic "ask Stack Overflow" question. But it's a friction point for myself (and presumably others) that the project can fall over when re-building from an unchanged package.json, even with locked version numbers. And that doesn't happen with any other packages that I use.

I hope I've explained that clearly. It's not necessarily a bug with the package, but (I guess) an issue that arises from having a fast-moving project where users aren't using the package.json file as you intend.

It could just be that the installation documentation can have a section about versioning and that would help us understand the correct way to set up our package.json files.

@fzaninotto
Copy link
Member

The problem is that the dependencies with internal packages (ra-core, ra-ui-materialui) in react-admin use ^ instead of ~:

    "dependencies": {
        "@material-ui/core": "^4.11.2",
        "@material-ui/icons": "^4.11.2",
        "@material-ui/styles": "^4.11.2",
        "connected-react-router": "^6.5.2",
        "final-form": "^4.20.0",
        "final-form-arrays": "^3.0.1",
        "ra-core": "^3.13.1",
        "ra-i18n-polyglot": "^3.13.1",
        "ra-language-english": "^3.13.1",
        "ra-ui-materialui": "^3.13.1",
        "react-final-form": "^6.3.3",
        "react-final-form-arrays": "^3.1.1",
        "react-redux": "^7.1.0",
        "react-router": "^5.1.0",
        "react-router-dom": "^5.1.0",
        "redux": "^3.7.2 || ^4.0.3",
        "redux-saga": "^1.0.0"
    }

This is not something we can fix for past version, but we should definitely switch to ~ ASAP.

Marking this as a bug.

@danjebs
Copy link

danjebs commented Mar 4, 2021

Thanks for the quick response guys 🎉💃❤️

WiXSL pushed a commit to WiXSL/react-admin that referenced this issue Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants