Closed jianliao closed 1 year ago
I am pretty sure this issue was introduced by version v13.3.1-canary.12.
You are using probably a monorepo if is the case I have posted one workaround in the meantime
Thank you for your reply. Yes, our project uses a monorepo package called @adobe/react-spectrum, which is an umbrella package that is used in all the React Spectrum component packages. This is a fairly common pattern for a UI component library. However, it is important to note that Next.js supported this usage until v13.3.1-canary.12. Therefore, we hope that Next.js will continue to support this usage in future versions as well.
I found a potential related swc-project/swc#5009 in swc-project/swc repo.
Tried v13.3.1-canary.17, problem still exists.
Having this problem in v13.3.1
. Using simple turborepo here.
Maybe this could be given extra attention? This literally bombs when trying to follow the Getting Started guide. Thanks!
I'm getting the same errors using Turborepo. My additional information mimic for the original reports but I also hopped over to a machine to confirm the results and those details are below. So I've received the same result on both MacOS and Windows. I, too am starting from 'getting started' so this Next app is brand new, but been a non-starter as this presents itself right out the gate.
Thanks and let me know if I can provide any better detail. I can post my macOS details as needed but they mimic the og post as mentioned earlier.
> prodkt-builder@0.1.0 build C:\ProdktDevelopment\prodkt-cloud\apps\prodkt-builder
> next build
info - Skipping linting
info - Checking validity of types...
info - Creating an optimized production build...
Failed to compile.
../../node_modules/@internationalized/date/dist/import.mjs
Module not found: Can't resolve '@swc/helpers/src/_class_private_field_init.mjs'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
../../node_modules/@react-aria/i18n/dist/real-module.mjs
../../node_modules/@react-aria/i18n/dist/import.mjs
../../node_modules/@react-aria/select/dist/import.mjs
../../node_modules/@plasmicapp/react-web/dist/react-web.esm.js
./pages/_app.tsx
../../node_modules/@internationalized/date/dist/import.mjs
Module not found: Can't resolve '@swc/helpers/src/_define_property.mjs'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
../../node_modules/@react-aria/i18n/dist/real-module.mjs
../../node_modules/@react-aria/i18n/dist/import.mjs
../../node_modules/@react-aria/select/dist/import.mjs
../../node_modules/@plasmicapp/react-web/dist/react-web.esm.js
./pages/_app.tsx
../../node_modules/@react-aria/focus/dist/import.mjs
Module not found: Can't resolve '@swc/helpers/src/_define_property.mjs'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
../../node_modules/@plasmicapp/react-web/dist/react-web.esm.js
./pages/_app.tsx
../../node_modules/@react-stately/collections/dist/import.mjs
Module not found: Can't resolve '@swc/helpers/src/_define_property.mjs'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
../../node_modules/@plasmicapp/react-web/dist/react-web.esm.js
./pages/_app.tsx
../../node_modules/@react-stately/list/dist/import.mjs
Module not found: Can't resolve '@swc/helpers/src/_define_property.mjs'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
../../node_modules/@react-stately/select/dist/import.mjs
../../node_modules/@plasmicapp/react-web/dist/react-web.esm.js
./pages/_app.tsx
> Build failed because of webpack errors
ELIFECYCLE Command failed with exit code 1.
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Home
Binaries:
Node: 16.20.0
npm: N/A
Yarn: N/A
pnpm: 8.1.1
Relevant packages:
next: 13.3.1
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
When using 13.2.x everything works fine. This is 4 days open and literally makes the framework unusable, will anyone fix this?
Getting the same with @internationalized/date
- seems related to Adobe packages.
For people looking for a temporary fix you can use this workaround
https://github.com/vercel/next.js/issues/48577
this issue is not only attached to @swc/helpers this issue es related to all packages that has different versions installed in monorepo. This is failing only in this because the helpers change from the v0.4 to the 0.5 the structure so when resolving to the last version that src folder does not exist
also if you use turbopack the issue does not exist.
@joacub, thanks for sharing your findings and the temporary workaround in #48577. I appreciate your insight on the issue and the connection with monorepos.
--install-strategy=nested
, the build still fails with the same reason.It's worth noting that if the issue doesn't exist when using turbopack, it could be an alternative solution for some users. However, it would be helpful if the @swc/helpers maintainers could clarify whether the changes between v0.4 and v0.5 should be considered breaking and if there is a recommended migration path for dependent packages.
@joacub, thanks for sharing your findings and the temporary workaround in #48577. I appreciate your insight on the issue and the connection with monorepos.
- I also confirmed that all the @adobe/react-* packages depend on @swc/helpers@^0.4.14 and that Next.js upgraded to @swc/helpers@0.5.0 in its canary v13.3.1-canary.12 release.
- I find it surprising that this is not considered a breaking change from the point of view of the @swc/helpers library. As you mentioned, the package folder structure has completely changed, and all the package entry points are different. This could potentially cause compatibility issues for dependent packages.
- Regarding the bug reproducer repo I posted in this Github issue, I found that even when installing the npm package using
--install-strategy=nested
, the build still fails with the same reason.It's worth noting that if the issue doesn't exist when using turbopack, it could be an alternative solution for some users. However, it would be helpful if the @swc/helpers maintainers could clarify whether the changes between v0.4 and v0.5 should be considered breaking and if there is a recommended migration path for dependent packages.
In monorepos is valid to have different versions not compatible each other, Webpack or nextjs is just not resolving correctly to the package.json node_modules relative to that package, the package exist and it is installed, webpack is just not doing right or next i don’t know who , that’s why the plug-in in Webpack resolved correctly which is a pretty easy solution and I’m really suprised that Webpack is not resolving correctly as that’s how webpack resolved usually. but I don’t know ….
I think @swc/helpers@v0.4.x
and @swc/helpers@v0.5.x
is merged without checking semver compatibility.
@jianliao A change from v0.4.x
to v0.5.x
is a breaking change.
This error is geting fixed by using nextjs version 13.2.4
This error is geting fixed by using nextjs version 13.2.4
Just like I said, if you use 13.2.x it works. Just not a great of a "fix" ah ah just use a version from couple months ago
I had such error for react-aria
on "next": "13.3.1"
. Downgrading to "next": "13.3.0"
helped.
P.S. probably you need to set exact version, if you already have 13.3.1
in lock file changing version from "next": "^13.3.1"
to "^13.3.0"
. will probably make no effect since the versions are compatible because of ^
I had such error for
react-aria
on"next": "13.3.1"
. Downgrading to"next": "13.3.0"
helped.P.S. probably you need to set exact version, if you already have
13.3.1
in lock file changing version from"next": "^13.3.1"
to"^13.3.0"
. will probably make no effect since the versions are compatible because of^
yeah, I also noticed that some early version work if you don't use the ^
I had such error for
react-aria
on"next": "13.3.1"
. Downgrading to"next": "13.3.0"
helped.P.S. probably you need to set exact version, if you already have
13.3.1
in lock file changing version from"next": "^13.3.1"
to"^13.3.0"
. will probably make no effect since the versions are compatible because of^
Good tip actually, I was under the assumption I had to go back to 12.2.x because I use ~
which uses latest patch version.
So ~13.3.0
= 13.3.1
I tried almost all solutions but the same issue! did anyone resolve it?
error - ./node_modules/@internationalized/date/dist/import.mjs:1:0
Module not found: Can't resolve '@swc/helpers/src/_class_private_field_init.mjs'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/@react-aria/i18n/dist/real-module.js
./node_modules/@react-aria/i18n/dist/module.js
./node_modules/@nextui-org/react/esm/index.js
./src/providers/index.tsx
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: ENOENT: no such file or directory, rename 'xx/.next/cache/webpack/client-development-fallback/0.pack_' -> 'xx/.next/cache/webpack/client-development-fallback/0.pack'
I had such error for
react-aria
on"next": "13.3.1"
. Downgrading to"next": "13.3.0"
helped.P.S. probably you need to set exact version, if you already have
13.3.1
in lock file changing version from"next": "^13.3.1"
to"^13.3.0"
. will probably make no effect since the versions are compatible because of^
Thanks! Resolved ✅
I am also experiencing similar issue with node_modules/next/node_modules/@swc/helpers
in Next.js 13.3.1:
error - node_modules/next/node_modules/@swc/helpers/lib/_interop_require_wildcard.js (5:0) @ eval
error - TypeError: Cannot redefine property: default
at Function.defineProperty (<anonymous>)
Installing Next.js 13.3.0 makes the issue disappear.
This is the cause. There's no logic for respecting the semver of @swc/helpers
.
@magic-akari How do you think about exposing @swc/helpers/src/xxx.mjs
along with the new helpers (@swc/helpers/_/*
) to workaround this issue (for a while)?
Technically, this is not a problem of SWC, but I'm not sure if specifying semver in resolve.alias
of webpack is possible.
This is the cause. There's no logic for respecting the semver of
@swc/helpers
.@magic-akari How do you think about exposing
@swc/helpers/src/xxx.mjs
along with the new helpers (@swc/helpers/_/*
) to workaround this issue (for a while)?Technically, this is not a problem of SWC, but I'm not sure if specifying semver in
resolve.alias
of webpack is possible.
I have posted a solution in the meantime this get resolved, look here for the webpack simple plugin
here just in case:
https://github.com/vercel/next.js/issues/48593#issuecomment-1519111776
@joacub I'm not asking for a workaround. I'm the author of the swc project and I'm working to fix this issue.
@joacub I'm not asking for a workaround. I'm the author of the swc project.
o sorry didn't saw that, good, in my understanding there is nothing wrong in you library, webpack is enough smart to resolve the correct package with many different versions with no collision.
that line that you posted force every one to use the same @swc/helpers version. they should remove if is possible.
This is the cause. There's no logic for respecting the semver of
@swc/helpers
.@magic-akari How do you think about exposing
@swc/helpers/src/xxx.mjs
along with the new helpers (@swc/helpers/_/*
) to workaround this issue (for a while)?Technically, this is not a problem of SWC, but I'm not sure if specifying semver in
resolve.alias
of webpack is possible.
It's a simple task to add src/*.mjs
entry back.
I find that you have submitted #48806 .
Should we still need to fix this issue in @swc/helpers? @kdy1
I think https://github.com/vercel/next.js/pull/48806 will not work, so I'm still considering fixing it from @swc/helpers
side
Can you try updating @swc/helpers
to v0.5.1
?
https://github.com/vercel/next.js/pull/48808 will change the default to v0.5.1
, but in the meantime you can update @swc/helpers
When I try to use any of UI libraries in Next.js, this error shows me
https://prnt.sc/_YY1SozdFlSw
@yousufislamme try adding:
"overrides": {
"next@13.3.1": {
"@swc/helpers": "0.5.1"
}
}
to your package.json
Confirmed. The issue had been fixed on next@13.3.2-canary.6
for my reproducer repo.
just to note that also this version seems like there is a huge improvement in building times, I was experiencing inside docker cold build times of 6 seconds to 20 seconds, and now seems like rock solid 2 seconds, still high but much better.
do we have any release versions to fix this issue?
@huykon It's released in v13.3.2-canary.6
for some reason im getting this error in next v13.2.4 . It was working until I installed @react-aria/i18n, I can't figure out why
@yousufislamme try adding:
"overrides": { "next@13.3.1": { "@swc/helpers": "0.5.1" } }
to your
package.json
Does this give anyone else this error?
npm ERR! code EOVERRIDE
npm ERR! Override for next@^13.3.1 conflicts with direct dependency
@clearly-outsane I'm seeing the same thing with @react-aria/focus. I'm having trouble creating a minimal repro to offer the Next.js team though, can you? And are you using a monorepo by chance?
In 13.3.2-canary.11
the build works, but I get the following runtime error for anything in the appDir
:
error - ../../node_modules/@react-aria/focus/dist/main.js (687:0) @ new $a7a032acae3ddda9$var$Tree
error - TypeError: (0 , $parcel$interopDefault(...)) is not a function
And here's the line in @react-aria/focus
where the failure is happening, note it's still @swc/helpers
.
(0, ($parcel$interopDefault($aB6Cp$swchelperslib_define_propertyjs)))(this, "children", []);
I'll try another fix
I still have this issue with Jest and @swc/jest
also errors coming from the react-aria packages
@salamaashoush You may have try the recently released Next.js of version 13.3.2. All the errors mentioned above was resolved in this version. I have no errors with this new version of Next.js.
v13.3.2 officially released to solve this issue. See: https://github.com/vercel/next.js/releases/tag/v13.3.2
yeah maybe I should report it on the react-aria or swc repo since I am not using nextjs and I have the same error but with jest, any help @kdy1?
Facing this issue on next@13.3.4
after import { NextUIProvider } from '@nextui-org/react'
into layout.tsx
using appdir
When trying to deploy Docker on Ubuntu 22.04 I get the following:
Next version: 13.4.1
#20 36.34 Module not found: Can't resolve './projects/Card'
#20 36.34
#20 36.34 https://nextjs.org/docs/messages/module-not-found
#20 36.34
#20 36.34 ./src/app/projects/project/[slug]/Intro.tsx
#20 36.34 Module not found: Can't resolve '@/projects/Tags'
#20 36.34
#20 36.34 https://nextjs.org/docs/messages/module-not-found
#20 36.34
#20 36.34 ./src/app/about/page.tsx
#20 36.34 Module not found: Can't resolve './Intro'
#20 36.34
#20 36.34 https://nextjs.org/docs/messages/module-not-found
#20 36.34
#20 36.34 ./src/app/about/page.tsx
#20 36.34 Module not found: Can't resolve './Technologies'
But on my Macbook M1 using Docker the errors don't happen
I still have this issue with Jest when using Next 13.4.4. The latest Next version that works for me is 13.3.0.
How to fix this bug in nextjs@12.x ?
I still have this issue with Jest when using Next 13.4.4. The latest Next version that works for me is 13.3.0.
I have the issue on 13.3.0 oddly.
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true)
Link to the code that reproduces this issue
https://github.com/jianliao/nextjs-rsp-bug
To Reproduce
The issue is exactly same as #38192.
Describe the Bug
After upgrade to
next@13.3.1-canary.16
, next build will fail with below error messages:Expected Behavior
Build success.
Which browser are you using? (if relevant)
Chrome 113.0.5672.35
How are you deploying your application? (if relevant)
next build