nx
nx copied to clipboard
Error creating a brand new project with `next` preset
Current Behavior
When creating a brand new project using npx [email protected] --preset=next myorg
, using NodeJS@20 after answering all the questions with the defaults:
➜ npx [email protected] --preset=next myorg
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
✔ Application name · myorg
✔ Would you like to use the App Router (recommended)? · Yes
✔ Would you like to use the src/ directory? · Yes
✔ Test runner to use for end to end (E2E) tests · cypress
✔ Default stylesheet format · css
✔ Set up CI with caching, distribution and test deflaking · github
NX Creating your v18.2.3 workspace.
✔ Installing dependencies with npm
✖ Creating your workspace in myorg
NX Failed to create a workspace.
Error: npm WARN deprecated [email protected]: Use your platform's native atob() and btoa() methods instead
The project is then not fully created due to this warning. There are several packages using it on this project:
➜ cat pnpm-lock.yaml | yq '.packages | to_entries[] | select(.value.dependencies.abab == "2.0.6") | .key'
/[email protected]
/[email protected]
/[email protected]
/[email protected]
/[email protected]([email protected])
Expected Behavior
The expected behavior is that I get an nx
workspace with a nextjs
preset. No errors due to the warning when generating the project.
GitHub Repo
No response
Steps to Reproduce
- Execute.
npx [email protected] --preset=next myorg
- Follow all of the default values
- Get the error due to the warning.
Nx Report
NX Report complete - copy this into the issue template
Node : 16.17.1
OS : darwin-arm64
npm : 9.8.1
nx : 18.2.4
@nx/js : 18.2.4
@nx/jest : 16.5.5
@nx/linter : 18.2.4
@nx/eslint : 18.2.4
@nrwl/linter : 16.5.5
@nx/workspace : 18.2.4
@nx/devkit : 18.2.4
@nx/nest : 16.5.5
@nx/next : 18.2.4
@nx/node : 16.5.5
@nx/react : 18.2.4
@nrwl/tao : 18.2.4
@nx/web : 18.2.4
@nx/webpack : 18.2.4
typescript : 5.4.4
---------------------------------------
The following packages should match the installed version of nx
- @nx/[email protected]
- @nrwl/[email protected]
- @nrwl/[email protected]
- @nx/[email protected]
- @nrwl/[email protected]
- @nx/[email protected]
- @nrwl/[email protected]
To fix this, run `nx migrate [email protected]`
Failure Logs
After executing, these are the logs:
➜ npx [email protected] --preset=next myorg
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
✔ Application name · myorg
✔ Would you like to use the App Router (recommended)? · Yes
✔ Would you like to use the src/ directory? · Yes
✔ Test runner to use for end to end (E2E) tests · cypress
✔ Default stylesheet format · css
✔ Set up CI with caching, distribution and test deflaking · github
NX Creating your v18.2.3 workspace.
✔ Installing dependencies with npm
✖ Creating your workspace in myorg
NX Failed to create a workspace.
Error: npm WARN deprecated [email protected]: Use your platform's native atob() and btoa() methods instead
Package Manager Version
No response
Operating System
- [X] macOS
- [x] Linux
- [ ] Windows
- [ ] Other (Please specify)
Additional Information
No response
Same can be reproduced on Windows
$ npx create-nx-workspace <org>
Let's create a new workspace [https://nx.dev/getting-started/intro]
√ Which stack do you want to use? · node
√ What framework should be used? · nest
√ Integrated monorepo, or standalone project? · integrated
√ Application name · api
√ Would you like to generate a Dockerfile? [https://docs.docker.com/] · Yes
√ Do you want Nx Cloud to make your CI fast? · skip
NX Creating your v18.3.2 workspace.
✔ Installing dependencies with npm
✖ Creating your workspace in <org>
NX Failed to create a workspace.
Exit code: 1
Log file: C:\Users\<username>\AppData\Local\Temp\tmp-53376-b61VarX41S9R\error.log
Relevant content of the error log:
NX generateFiles: No files found in "/Users/<username>/AppData/Local/Temp/tmp-45776-d4avIqbj16Wm/node_modules/@nx/nest/src/generators/application/files". Are you sure you specified the correct path?
Here's what i've noticed: Originally I ran the command in D:\some\folder\ - This caused the above error However, when I ran the exact same command in C:\temp, it ran successfully. Seems like during file generation the path is created incorrectly - as you can see in the error log's content too (should be C:\Users\etc...)
I assume something similar could be the issue on other OS too. Hope this helps to track down the issue!
@danazkari @Yianen were you ever able to get a Next project created? Running into the same error using 18.3.4
@danazkari @Yianen were you ever able to get a Next project created? Running into the same error using
18.3.4
After reporting the bug I haven't tried, I did try to look at the code and see if I could help with the issue but right now I'm handling several stuff at work and can't really follow through until end of May when I get time again to collaborate on FOSS again
The problem is that there's several dependencies that use that abab
package, and the generator panics at the presence of a warning and bails the project generation process... So either of the two could be the potential fix, either following and replacing where possible the dependencies that use that package, or perhaps having a flag that allows for warnings to passthrough
I am having the same error with creating a next.js project too. I am on MacOS
https://github.com/nrwl/nx/issues/23155
atob() is used in next.js project creation but it is not used anywhere in nx itself, wondering why...
can't this package be deleted if it is not used? atob should be used for decoding Base64 string but I am not seeing the need to use it here, same as abab, @danazkari you mentioned it is used by several dependencies, where is it? I only saw it is being installed
https://github.com/search?q=repo:nrwl/nx+abab&type=code&p=2
I am having the same error with creating a next.js project too. I am on MacOS
https://github.com/nrwl/nx/issues/23155
atob() is used in next.js project creation but it is not used anywhere in nx itself, wondering why...
can't this package be deleted if it is not used? atob should be used for decoding Base64 string but I am not seeing the need to use it here, same as abab, @danazkari you mentioned it is used by several dependencies, where is it? I only saw it is being installed
https://github.com/search?q=repo:nrwl/nx+abab&type=code&p=2
![]()
So if you run this command against the lock file, you get all the dependencies and sub-dependencies (I might be wrong for sure)
➜ cat pnpm-lock.yaml | yq '.packages | to_entries[] | select(.value.dependencies.abab == "2.0.6") | .key'
/[email protected]
/[email protected]
/[email protected]
/[email protected]
/[email protected]([email protected])
@zmzlois I think you're looking into a different package though, the one givinge issues is abab
not atob
at least on what I tested so far.
Hey, can you retry with the latest version I am not encountering this issue.
Hey, can you retry with the latest version I am not encountering this issue.
Sure thing, I'll retry tomorrow first thing in the morning! Thanks for checking, I'll report back.
This is happening while creating expo project as well.
This issue has been automatically marked as stale because no results of retrying on the latest version of Nx was provided within 7 days. It will be closed in 21 days if no results are provided. If the issue is still present, please reply to keep it active. If the issue was not present, please close this issue. Thanks for being a part of the Nx community! 🙏
Hey, can you retry with the latest version I am not encountering this issue.
So I FINALLY was able to have some time to retry and long-story short... it's still not working
➜ npx create-nx-workspace@latest --preset=next myorg
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
✔ Application name · myorg
✔ Would you like to use the App Router (recommended)? · Yes
✔ Would you like to use the src/ directory? · Yes
✔ Test runner to use for end to end (E2E) tests · playwright
✔ Default stylesheet format · css
✔ Set up CI with caching, distribution and test deflaking · github
NX Creating your v19.1.0 workspace.
✔ Installing dependencies with npm
✖ Creating your workspace in myorg
NX Failed to create a workspace.
Exit code: 1
Log file: /var/folders/_g/szgq3nnj4hj4bnccgkl1qznw0000gn/T/tmp-33974-ylU7FOFSBuUt/error.log
As for that error.log
file:
➜ cat /var/folders/_g/szgq3nnj4hj4bnccgkl1qznw0000gn/T/tmp-33974-ylU7FOFSBuUt/error.log
added 819 packages, and audited 820 packages in 49s
120 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
NX Generating @nx/workspace:preset
Fetching prettier...
Fetching @nx/playwright...
NX configurationGenerator is not a function
Pass --verbose to see the stacktrace.
NX Workspace creation failed, see above.
Pass --verbose to see the stacktrace.
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: Use your platform's native atob() and btoa() methods instead
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
Are you absolutely certain you're not getting the issue with the newer versions? Seems like I'm using the latest version already... I can try using Nix flakes
to get as fresh of an install as I can. Trying now.
I just tried a bit differently, using DevBox which is an easy way of executing a nix shell and having a clean slate with no other dependencies and still same luck, here's a recording of it:
I encountered the same issue and managed to resolve it by following these steps:
-
Downgraded pnpm to version 8:
npm install -g pnpm@8
-
Installed the global version of nx (v18.0.4):
npm install -g [email protected]
-
Created the Nx workspace using the specified version:
pnpm dlx [email protected]
These steps successfully resolved the issue for me. Hopefully, this can help others who are experiencing the same problem.
I encountered the same issue and managed to resolve it by following these steps:
- Downgraded pnpm to version 8:
npm install -g pnpm@8
- Installed the global version of nx (v18.0.4):
npm install -g [email protected]
- Created the Nx workspace using the specified version:
pnpm dlx [email protected]
These steps successfully resolved the issue for me. Hopefully, this can help others who are experiencing the same problem.
Which version of node are you running? I'm getting this issue with versions 20 and 21. I just tried your method and still getting same issue:
That's strange because I'm using the LTS version iron -> v20.14.0 of Node.
the problem doesn't happen anymore atm, will report back if it does
Issue Recreated
PNPM
[email protected]
[email protected]
[email protected]
➜ Learn pnpm dlx create-nx-workspace
Packages: +56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 56, reused 56, downloaded 0, added 56, done
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
✔ Where would you like to create your workspace? · nx-example
✔ Which stack do you want to use? · node
✔ What framework should be used? · fastify
✔ Integrated monorepo, or standalone project? · integrated
✔ Application name · nx-example
✔ Would you like to generate a Dockerfile? [https://docs.docker.com/] · Yes
✔ Set up CI with caching, distribution and test deflaking · skip
✔ Would you like remote caching to make your build faster? · skip
NX Creating your v19.1.2 workspace.
✔ Installing dependencies with pnpm
✖ Creating your workspace in nx-example
NX Failed to create a workspace.
Exit code: 1
Log file: /var/folders/kz/x8l16ncj77nftv6b_54b9ksw0000gn/T/tmp-4881-b6oH6XzH0054/error.log
Workaround
You can workaround this issue by generating a blank monorepo, and then adding your application and libraries after.
- Select
None
when askedWhich stack do you want to use?
- Add the generator for your prefferred stack with
nx add @nx/node
- Generate your application
nx g @nx/node:application api
I get similar problems with:
$ npx create-nx-workspace nx-example
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
✔ Which stack do you want to use? · node
✔ What framework should be used? · none
✔ Integrated monorepo, or standalone project? · integrated
✔ Application name · my-app
✔ Would you like to generate a Dockerfile? [https://docs.docker.com/] · Yes
✔ Do you want Nx Cloud to make your CI fast? · skip
NX Creating your v19.1.2 workspace.
✔ Installing dependencies with npm
✖ Creating your workspace in nx-example
NX Failed to create a workspace.
Error: npm WARN deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated [email protected]: Glob versions prior to v9 are no longer supported
System Info:
Ubuntu 22.04.4 LTS
Node: v22.2.0
NPM: 10.8.1
same
Error: npm WARN deprecated [email protected] - still remains
This issue has been automatically marked as stale because no results of retrying on the latest version of Nx was provided within 7 days. It will be closed in 21 days if no results are provided. If the issue is still present, please reply to keep it active. If the issue was not present, please close this issue. Thanks for being a part of the Nx community! 🙏
This issue is still relevant on the latest version of create-nx-workspace
on Windows:
$ npx [email protected]
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
√ Where would you like to create your workspace? · demo
√ Which stack do you want to use? · node
√ What framework should be used? · nest
√ Integrated monorepo, or standalone project? · integrated
√ Application name · demo
√ Would you like to generate a Dockerfile? [https://docs.docker.com/] · No
NX Creating your v19.3.2 workspace.
✔ Installing dependencies with npm
✖ Creating your workspace in demo
NX Failed to create a workspace.
Error: npm WARN deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated [email protected]: Glob versions prior to v9 are no longer supported
This issue has been automatically marked as stale because no results of retrying on the latest version of Nx was provided within 7 days. It will be closed in 21 days if no results are provided. If the issue is still present, please reply to keep it active. If the issue was not present, please close this issue. Thanks for being a part of the Nx community! 🙏
Still happening FYI
FWIW Something similar (with a different package) was happening to me with the react native preset and i got it to go away by foregoing testing (I'm just writing a prototype so idc).
:~/Documents$ npx create-nx-workspace happynrwl \
--preset=react-native \
--appName=mobile
Need to install the following packages:
[email protected]
Ok to proceed? (y) y
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
✔ Test runner to use for end to end (E2E) tests · playwright
✔ Which CI provider would you like to use? · skip
✔ Would you like remote caching to make your build faster? · skip
NX Creating your v19.6.4 workspace.
✔ Installing dependencies with npm
✖ Creating your workspace in happynrwl
NX Failed to create a workspace.
Error: npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
:~/Documents$ npx create-nx-workspace happynrwl --preset=react-native --appName=mobile --verbose
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
✔ Test runner to use for end to end (E2E) tests · none
✔ Which CI provider would you like to use? · skip
✔ Would you like remote caching to make your build faster? · skip
NX Creating your v19.6.4 workspace.
✔ Installing dependencies with npm
✔ Successfully created the workspace: happynrwl.
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.