npx create-nx-workspace@latest fails - unable to build workspace
See original GitHub issueCurrent Behavior
npx create-nx-workspace@latest fails to run and exits with errors “Unable to resolve @nrwl/workspace/collection.json:new.”
Expected Behavior
npx create-nx-workspace@latest should build the workspace and allow apps to be added
Steps to Reproduce
create new folder, cd into folder. type npx create-nx-workspace@latest in the terminal
Failure Logs
➜ multipleNX npx create-nx-workspace@latest
npx: installed 192 in 7.769s
? Workspace name (e.g., org name) chicnraw
? What to create in the new workspace angular [a workspace with a single Angular application]
? Application name webstore
? Default stylesheet format CSS
? Default linter TSLint [ Used by Angular CLI ]
? Use Nx Cloud? (It's free and doesn't require registration.) No
Creating a sandbox with Nx...
added 192 packages from 155 contributors and audited 193 packages in 4.786s
23 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
new chicnraw --no-interactive --preset=angular --appName=webstore --style=css --linter=tslint --no-nxCloud --collection=@nrwl/workspace
Unable to resolve @nrwl/workspace/collection.json:new.
Cannot find generator 'new' in /Users/cuznerdexter/node_modules/@nrwl/workspace/collection.json.
(node:32464) UnhandledPromiseRejectionWarning: Error: Command failed: npx tao new chicnraw --no-interactive --preset=angular --appName=webstore --style=css --linter=tslint --no-nxCloud --collection=@nrwl/workspace/collection.json --cli=angular --nxWorkspaceRoot="/Users/cuznerdexter/Development/Projects/experiments/multipleNX"
at checkExecSyncError (child_process.js:629:11)
at Object.execSync (child_process.js:666:13)
at createApp (/Users/cuznerdexter/.npm/_npx/32459/lib/node_modules/create-nx-workspace/bin/create-nx-workspace.js:366:21)
at askAboutNxCloud.then (/Users/cuznerdexter/.npm/_npx/32459/lib/node_modules/create-nx-workspace/bin/create-nx-workspace.js:92:29)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:32464) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:32464) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
➜ multipleNX
Environment
unable to use nx report as no workspace is created. OS: MacOS Catalina NVM installed. Using node v12.4.0 Using npm 6.14.4
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Failed to create nx workspace - node.js - Stack Overflow
I am facing the same issue for resolving use below command for creating new workspace:- npx create-nx-workspace --preset=angular ...
Read more >create-nx-workspace - CLI command
Install create-nx-workspace globally to invoke the command directly, or use npx create-nx-workspace , yarn create nx-workspace , or pnpx create-nx-workspace ...
Read more >create-nx-workspace - npm
Smart, Fast and Extensible Build System. Latest version: 15.4.1, last published: 2 days ago. Start using create-nx-workspace in your project ...
Read more >Nx/community - nrwl - Gitter
I am trying something really messy at the moment - but it is not working. This is my failed attempt: Adding a run...
Read more >2 - Creating an Nx Workspace - Angular and NgRx - GitBook
Run the below command in a terminal to make a new nx workspace. ... Successfully initialized git. CREATE demo-app/nx.json (463 ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think the issue is that you somehow got node_module in your home folder, and they have an old version of @nrwl/workspace in them. So basically you are trying to create a new nx workspace from within another nx workspace, which happens to be old. Just remove the node modules in your home dir and it should fix the issue.
If anyone has the same issue. My current work-around is to run
npx create-nx-workpspace@11.0.15
in my/tmp folder
then move the folder to somewhere useful. After this all the nx commands are working as normal for me so far.Not a great solution but will do for now.