Closed (fixed)
Project:
Next.js Webform
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
30 Oct 2023 at 19:53 UTC
Updated:
15 Nov 2023 at 09:19 UTC
Jump to comment: Most recent
npm i next@^14.0
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: ksb-website@1.0.0
npm WARN Found: next@13.5.6
npm WARN node_modules/next
npm WARN peer next@"^10.0.8 || ^11.0 || ^12.0 || ^13.0 || ^14.0" from @sentry/nextjs@7.76.0
npm WARN node_modules/@sentry/nextjs
npm WARN @sentry/nextjs@"^7.65.0" from the root project
npm WARN 5 more (@storybook/nextjs, next-drupal, nextjs-drupal-webform, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer next@"^13.0.0" from nextjs-drupal-webform@1.0.0
npm WARN node_modules/nextjs-drupal-webform
npm WARN nextjs-drupal-webform@"^1.0.0" from the root project
As next.js 14 does not provide any new APIs it should "just work".
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
yobottehg commentedThere is currently no cypress-browser docker image with NodeJS 18 >= 18.17 which is the minimum requirement of next.js 14.
Tests are failing on the Node 20 image.
Unsure what is the wanted approach here:
Option 1: Make tests pass on NodeJS 20
Option 2: Use different docker image as test runner on GitLab.
Comment #4
lauriiiThanks for reporting the issue and working on this! Great work so far btw.
I think it would be great if we could make the tests work with Node.js 20. However, I'm wondering if the problem is Node.js 20 specific. Can you reproduce this locally?
I can see the following error in the CI output which sounds like there's something wrong with the application itself:
Comment #6
hooroomooI looked at the test app locally and was getting
TypeError: Cannot read properties of null (reading 'useEffect')and"Invalid hook call. Hooks can only be called inside of the body of a function component."along with other errors. It was crashing on this import statement.import { useEffect, useState, useRef } from 'react';Seems the error was happening because of:
with the submodule being our tests/example-app used for testing with its own node modules.
I added new webpack config in
tests/example-app/next.config.jsfrom the blog post which instructs webpack to resolve all imports of 'react' to the specific version of React in the node_modules directory.Comment #7
lauriiiNice! 👏 Thank you @hooroomoo for fixing this and explaining how you fixed it!
Comment #8
lauriiiFYI, tagged a new release for this: https://www.npmjs.com/package/nextjs-drupal-webform/v/1.1.0.
Comment #9
yobottehg commentedSorry but somehow the peer dependencies are not working for me.
Trying to install 1.1 on my next project yields the following:
Directly upgrading to 14 also does not work:
From this SO thread i think i did the equation wrong:
https://stackoverflow.com/questions/47309598/make-your-npm-package-suppo...
and it needs to be
Comment #11
yobottehg commentedComment #12
lauriiiThank you @yobottehg! Not sure why this was working when I tested it locally but you're right that the dependency constraint is wrong. Making a new release in a moment.