-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
UnhandledRejection Error: Cannot Find React Package #90
Comments
same here |
@rektdeckard |
Same here. Cannot use IconContext.Provider in _app.tsx in a Next JS (pages router) app, or I get the "Did you mean to import "react/index.js"?" crash |
@IvanNavin I fixed it. It is because you are importing the ssr version instead of the normal react version. Change your ic import to "import { ArrowArcRight } from "@phosphor-icons/react";" instead of "import { ArrowRight } from "@phosphor-icons/react/dist/ssr"; Update: It was a fluke, or something. The problem is back. |
@oscadev I would be very happy to fix this using that approach, but I don't have a path like '@phosphor-icons/react/dist/ssr' anywhere. |
Any update for this issue. it works as expected inprevious version, that is 2.0.15
|
Can confirm I am seeing the same issue on 2.0.14, building a docker image for production in node:20.10.0 |
Same here. I updated to Nextjs 14 and React to 18 along with that and that's when the issue started.
Using |
Yep. It looks to be this. I fixed it by installing the |
Are you sure you didn't have this cached? I can't get any of the mentioned versions working nor my old version of My versions:
|
@fanzypantz yep. I checked it after I did "dependencies": {
"@phosphor-icons/react": "2.1.3",
"next": "14.1.4",
"react": "18.2.0",
"react-dom": "18.2.0",
} |
The weird thing, is that this works on my coworkers computer, he also did the cache cleaning, and a random local Linux server we have for development. Edit: He could not build the docker image But not in our dockerimage, or my local computer. The Dockerfile isn't especially complicated. # Node version
FROM node:20.10.0 AS builder
ENV NEXT_PUBLIC_API_ENDPOINT=
ENV NEXT_PUBLIC_BASE_URL=
# Install required build tools
RUN apt-get update && \
apt-get -y install gcc
# Create app directory
WORKDIR /app
# Add the source code to app
COPY package*.json ./
COPY lerna.json ./
COPY /packages ./packages
# Install all the dependencies
RUN yarn install
RUN yarn global add tscpaths
COPY . .
# Generate the build of the application
RUN yarn build
FROM node:20.10.0 AS runner
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/packages ./packages
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/lerna.json ./
EXPOSE 3000
CMD [ "yarn", "start" ] |
Seeing this issue with the following dependencies as well when we upgraded to "dependencies": {
"@phosphor-icons/react": "^2.1.4",
"next": "14.2.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
} Importing like so as it reduces the number of modules next.js includes import { Flask } from "@phosphor-icons/react/dist/csr/Flask" Downgrading back to |
@ndom91 have you tried |
Make sure to use |
Hi all, apologies for delay in resolving this! Testing the hypothesis that it is caused by relying on automatic JSX runtime, as @omridevk suggests. I will be pushing some pre-release updates to NPM shortly and would appreciate some help testing, as many of these problems are intractable and arise from specific nuances of project setup. |
Have published an alpha that reverts to classic JSX runtime. Checked out locally with pnpm install @phosphor-icons/react@next
# ^ or @2.1.5-alpha.3 |
We had in fact been bundling the automatic JSX runtime, which was expecting to find a version of This was a non-issue in most builds, since the end-user's build tooling was probably also using automatic JSX runtime, consuming the ESM build of this library, and thus performing the JSX transform itself. I don't see any harm in reverting to classic JSX runtime. It has marginal performance and bundle impacts, so going ahead and shipping this. |
Can confirm updating to EDIT:
@rektdeckard was there an issue by externalizing the |
@schardev it won't work (or at least will error and require an additional package to be installed) for users of |
Seems to have done the trick. I'm marking as resolved. |
Thank you all very much |
Thanks @rektdeckard ! |
I'm encountering an unhandled rejection error with the following details:
It seems like the React package is not being found properly. The error suggests that it cannot locate the React package at a specific path. The message also includes a suggestion: "Did you mean to import react/index.js?"
OS: MacOs, Node.js, Docker
Stack:
Global packages:
Any insights or guidance on resolving this issue would be greatly appreciated.
The text was updated successfully, but these errors were encountered: