-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Bug?]: Error: Dynamic require of "util" is not supported #5831
Comments
Potentially related: evanw/esbuild#2113 |
I just resolved this. Someone in the discord suggested I may have a package.json in my users folder. After deleting that, I was able to set my version to berry but it also broke yarn. I couldn't run any yarn commands as it would just error out saying it couldnt find 1.22.19. I uninstalled node and deleted all the following folders:
After reinstalling node, I enabled corepack, went into my project, set the version to berry and its all working again. |
Thanks @jrj2211 , solve my problem. For me just remove C:\Users{User}\package.json But hard to find this answer, can you update this issue title with |
@naruto00fa Updated the title. Interesting, I had originally also tried to just remove the |
@jrj2211 I'm getting this when Even running
I'm on Node 18.12.1 (Windows 11) Edit: not sure why but this was failing because I also had |
The problem happens only for yarn 4. I've downgraded to yarn 3.2.4 and it's working fine 🤷♀️ |
Still facing this issue when deploying using a Dockerfile FROM node:20-alpine
# Yarn modern installation
RUN corepack enable
RUN yarn set version stable
# Move to working directory /build
WORKDIR /
# Copy the code into the container
COPY . .
# Install dependencies
RUN yarn install
# Export necessary ports
EXPOSE 8080
# Running the script that runs both the Go and NodeJS servers
CMD ["npm", "run", "prod:start"] |
I have this problem under linux, too. I have created a separate user. For that user $HOME is the root of the JS-project. It has $HOME/package.js . My understanding here is that $HOME/package.js is the root cause. So I changed to root, performed |
Stumbled upon this today, as well, on Alpine 3.19. @wojtekmaj Maybe we should consider re-opening the issue (unless it's being tracked somewhere else)? My problem was a ~ $ pwd
/home/user
~ $ ls
app package.json public server
~ $ corepack install
Adding yarn@4.1.1 to the cache...
~ $ yarn --version
file:///home/user/.cache/node/corepack/v1/yarn/4.1.1/yarn.js:4
Error: Dynamic require of "util" is not supported
at file:///home/user/.cache/node/corepack/v1/yarn/4.1.1/yarn.js:4:394
at file:///home/user/.cache/node/corepack/v1/yarn/4.1.1/yarn.js:4:3572
at file:///home/user/.cache/node/corepack/v1/yarn/4.1.1/yarn.js:4:478
at file:///home/user/.cache/node/corepack/v1/yarn/4.1.1/yarn.js:9:45685
at file:///home/user/.cache/node/corepack/v1/yarn/4.1.1/yarn.js:4:478
at file:///home/user/.cache/node/corepack/v1/yarn/4.1.1/yarn.js:392:1509
at file:///home/user/.cache/node/corepack/v1/yarn/4.1.1/yarn.js:734:11937
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
at async loadESM (node:internal/process/esm_loader:28:7) ~ $ node --version
v20.12.1
~ $ npm --version
10.2.5
~ $ corepack --version
0.28.0 |
Stumbled upon this after adding The error is described in a discussion in their repo and was closed. This is reproduced as simple as: # Outer package.json, could be anywhere up from the project dir
touch package.json && echo "{\"type\":\"module\"}" >> package.json
mkdir test && cd test
# Project package.json
touch package.json && echo "{\"packageManager\": \"yarn@3.8.4\"}" >> package.json
nvm use 20 # being specific just in case
corepack enable
yarn install Logging @wojtekmaj |
I got around this by overriding the vercel install command to: |
@joezappie could you reopen this issue please, as many of us are still having this problem with the latest yarn / in Docker etc. and none of the proposed solutions seem to work |
FWIW I worked around this issue by just committing the yarn release to the repo and redeploying to vercel. A bit janky but it works. YMMV. |
@joezappie I put together a simple Docker repository with a small NodeJS project that reproduces the issue. There is no excessive |
@adamreisnz @Supinic I've reopened the issue as it seems theres still some issues here past rogue I did try your docker build file though and can confirm I get the util error as well. |
Self-service
Describe the bug
I've tried on both node 18.8.2 and 20.8.1, uninstalling nodejs in between to try to clear it out.
I run
corepack enable
. Then I try to set the version to anything and it fails withError: Dynamic require of "util" is not supported
Stack Trace
To reproduce
N/A - Cant reproduce
Environment
Windows 11 Pro 22H2 Even running `yarn dlx -q envinfo --preset jest` gives me the same error of dynamic import so I cant get this information
Additional context
Did the update on my laptop and it worked fine there. I understand this may just be a weird issue with my windows install and I've been meaning to do a fresh install so it might just be time for that. Figured I'd post the issue in since 4.0 just released and figured it might be related.
The text was updated successfully, but these errors were encountered: