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

React JHipster lib: currently broken #16527

Closed
1 task done
pascalgrimaud opened this issue Oct 3, 2021 · 14 comments
Closed
1 task done

React JHipster lib: currently broken #16527

pascalgrimaud opened this issue Oct 3, 2021 · 14 comments
Labels
area: bug 🐛 $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ theme: dependencies Pull requests that update a dependency file theme: react $200 https://www.jhipster.tech/bug-bounties/
Milestone

Comments

@pascalgrimaud
Copy link
Member

Overview of the issue

I wanted to launch a release of this lib, but it's currently broken, when I launch: npm ci :

npm WARN old lockfile 
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile 
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile 
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react-transition-group
npm ERR!   peer react-transition-group@"^4.4.1" from the root project
npm ERR!   react-transition-group@"^2.3.1" from [email protected]
npm ERR!   node_modules/reactstrap
npm ERR!     dev reactstrap@"^8.9.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react-transition-group@"^4.4.1" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react-transition-group
npm ERR!   peer react-transition-group@"^4.4.1" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /home/pgrimaud/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pgrimaud/.npm/_logs/2021-10-03T09_14_41_667Z-debug.log

ping:

Motivation for or Use Case

We should be able to clone + npm ci, without problem

Reproduce the error
git clone https://github.com/jhipster/react-jhipster
cd react-jhipster
npm ci
Related issues
Suggest a Fix

Not sure about removing all peerDependencies:

diff --git a/package.json b/package.json
index cda6679..9676aa1 100644
--- a/package.json
+++ b/package.json
@@ -31,15 +31,6 @@
     "react-jhipster.ts"
   ],
   "homepage": "https://www.jhipster.tech",
-  "peerDependencies": {
-    "axios": "^0.21.1",
-    "dayjs": "^1.10.4",
-    "react": "^17.0.1",
-    "react-transition-group": "^4.4.1",
-    "react-dom": "^17.0.1",
-    "react-hook-form": "^7.6.8",
-    "reactstrap": "^8.9.0"
-  },
   "dependencies": {
     "lodash.get": "^4.4.2",
     "numeral": "^2.0.6",
JHipster Version(s)

[email protected]

JHipster configuration
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System

I use:
Node: v14.17.6
NPM: 7.22.0

  • Checking this box is mandatory (this is just to show you read everything)
@pascalgrimaud pascalgrimaud added area: bug 🐛 theme: react theme: dependencies Pull requests that update a dependency file labels Oct 3, 2021
@ctamisier
Copy link
Contributor

ctamisier commented Oct 3, 2021

It is working when using npm 6.14.15.
And it fails when using npm 7.24.1.

npm ci fails as well with react-jhipster v0.15 (npm 7.24.1)

If I remove package-lock.json and run npm install (with npm 7.24.1), it fails as well. (but it works with npm 6.14.15)

I'll try to understand why this is happening with npm (> 7 I guess).

@Jackjun724
Copy link

Jackjun724 commented Oct 3, 2021

It is working when using npm 6.14.15. And it fails when using npm 7.24.1.

npm ci fails as well with react-jhipster v0.15 (npm 7.24.1)

If I remove package-lock.json and run npm install (with npm 7.24.1), it fails as well. (but it works with npm 6.14.15)

I'll try to understand why this is happening with npm (> 7 I guess).

The last successfully built version is npm 7.15.1, My changes did not involve dependencies, but I will try to see where the problem.

@Jackjun724
Copy link

Related discussion npm/feedback#191

@mshima
Copy link
Member

mshima commented Oct 3, 2021

How is this evolving?
Peer dependencies are ignored at npm 6. So it’s new to npm 7.
I can take a look if needed.

@pascalgrimaud
Copy link
Member Author

Ok fine, so the best way would be to delete these peerDependencies and see if it works

@Jackjun724
Copy link

Jackjun724 commented Oct 4, 2021

@ctamisier Can you delete these peerDependencies ?

@ctamisier
Copy link
Contributor

@mshima
Copy link
Member

mshima commented Oct 4, 2021

I don’t think it will help.
For this release add a .npmrc file with the following content:
https://github.com/jhipster/generator-jhipster/blob/main/generators/client/templates/react/.npmrc.ejs

I will take a look at peer dependencies soon.

@pascalgrimaud pascalgrimaud added $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ $200 https://www.jhipster.tech/bug-bounties/ labels Oct 4, 2021
@pascalgrimaud
Copy link
Member Author

I don't understand @mshima
If it works without peerDependencies, why do we need this ? Sorry, I'm not a front guy :p

@pascalgrimaud
Copy link
Member Author

Adding a bounty, as it's the last ticket I need to launch the release 7.3.0

@mshima
Copy link
Member

mshima commented Oct 4, 2021

I don't understand @mshima
If it works without peerDependencies, why do we need this ? Sorry, I'm not a front guy :p

I may be wrong but I don't think it will work without peerDependencies.
peerDependencies are just like a dependency on current project.
It differs at derived projects, when the derived project should have only 1 version of the package to avoid duplications and conflicts.

The conflicts exists in the devDependencies.
Eg: jest@27 https://github.com/jhipster/react-jhipster/blob/6f8b5147ed182e3adb6e06ccf20d57d2e39f4a2a/package.json#L74
Requires a sibling @types/jest@27 not @types/jest@26 https://github.com/jhipster/react-jhipster/blob/6f8b5147ed182e3adb6e06ccf20d57d2e39f4a2a/package.json#L51

I've started to look at this yesterday jhipster/react-jhipster#73.
But tests are failing, may be easy to react developers to fix it.

@mshima
Copy link
Member

mshima commented Oct 8, 2021

Fixed in jhipster/react-jhipster#74, deployed and looks to be working by now.
Closing.

@mshima mshima closed this as completed Oct 8, 2021
@mshima
Copy link
Member

mshima commented Oct 10, 2021

@pascalgrimaud
Copy link
Member Author

@mshima : approved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: bug 🐛 $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ theme: dependencies Pull requests that update a dependency file theme: react $200 https://www.jhipster.tech/bug-bounties/
Projects
None yet
Development

No branches or pull requests

4 participants