Collection ... cannot be resolved
See original GitHub issuePlease make sure you have read the submission guidelines before posting an issue
Expected Behavior
Please describe the behavior you are expecting
- cli generate command fails 100% of the time
npx create-nx-workspace@latest repro-workspace
fails to generate a new application
Current Behavior
What is the current behavior?
Every single generate call fails with Collection "..." cannot be resolved.
nx generate @nrwl/angular:app myapp
--> Collection "@nrwl/angular" cannot be resolved.
nx generate @nrwl/react:app myapp
--> Collection "@nrwl/react" cannot be resolved.
nx generate @nrwl/node:app myapp
--> Collection "@nrwl/node" cannot be resolved.
nx generate @nrwl/angular:library mylibrary
--> Collection "@nrwl/angular" cannot be resolved.
nx generate @nrwl/react:library mylibrary
--> Collection "@nrwl/react" cannot be resolved.
nx generate @nrwl/node:library mylibrary
--> Collection "@nrwl/node" cannot be resolved.
npx create-nx-workspace@latest repro-workspace
--> see below for exact output
Failure Information (for bugs)
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
Path 1:
- Follow tutorial for react + express to create a repository (this worked at some point in the past, but now fails)
- Attempt to generate additional apps/libs from cli, for example
nx generate @nrwl/node:library mylibrary
- 😭 -->
Collection "@nrwl/node" cannot be resolved.
Path 2:
- Run
npx create-nx-workspace@latest repro-workspace
- react + express
- emotion
- 😭 -->
Collection "@nrwl/workspace" cannot be resolved.
Context
Please provide any relevant information about your setup:
- version of Nx used (Please run
nx report
at the root of your workspace and copy the results here if you are using Nx 8.6.1 or greater)
> NX Report complete - copy this into the issue template
@nrwl/angular : 8.12.11
@nrwl/cli : 9.2.4
@nrwl/cypress : 9.2.4
@nrwl/eslint-plugin-nx : 9.2.4
@nrwl/express : 9.2.4
@nrwl/jest : 9.2.4
@nrwl/linter : 9.2.4
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : 9.2.4
@nrwl/react : 9.2.4
@nrwl/schematics : 8.12.11
@nrwl/tao : 9.2.4
@nrwl/web : 9.2.4
@nrwl/workspace : 9.2.4
typescript : 3.8.3
- 3rd-party libraries and their versions - pretty sure this is
N/A
- and most importantly - a use-case that fails - See below for a new-new instal that fails with the same error
A minimal reproduction scenario allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem.
I tried creating a net-new repository and everything failed with Collection "@nrwl/workspace" cannot be resolved.
When I use version 8.x the generate command works without any issues
npx create-nx-workspace@latest repro-workspace
npx: installed 198 in 14.413s
? What to create in the new workspace react-express [a workspace with a full stack application (React + Express)]
? Application name repro
? Default stylesheet format emotion [ https://emotion.sh]
Creating a sandbox with Nx...
warning " > @nrwl/workspace@9.2.4" has incorrect peer dependency "prettier@^1.19.1".
[########################################################################################################################################################################] 364/364
warning Your current version of Yarn is out of date. The latest version is "1.22.4", while you're on "1.16.0".
new repro-workspace --preset="react-express" --appName="repro" --style="@emotion/styled" --interactive=false --collection=@nrwl/workspace
Collection "@nrwl/workspace" cannot be resolved.
(node:89995) UnhandledPromiseRejectionWarning: Error: Command failed: "/var/folders/g0/c7qwk52n1k5b20vy4sy9gdqm0000gn/T/tmp-89995bkvOcX1yhzim/node_modules/.bin/tao" new repro-workspace --preset="react-express" --appName="repro" --style="@emotion/styled" --interactive=false --collection=@nrwl/workspace
at checkExecSyncError (child_process.js:621:11)
at Object.execSync (child_process.js:658:15)
at createApp (/Users/foo/.npm/_npx/89995/lib/node_modules/create-nx-workspace/bin/create-nx-workspace.js:343:21)
at /Users/foo/.npm/_npx/89995/lib/node_modules/create-nx-workspace/bin/create-nx-workspace.js:76:21
at processTicksAndRejections (internal/process/task_queues.js:89:5)
(node:89995) 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: 2)
(node:89995) [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.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:5
You can pass a plugin name to it (e.g., nx list @nrwl/angular) to learn more about what the capabilities of that plugin. If that plugin not present then install it.
This issue is closed as duplicate, please post your comments in the main one: #2953