question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Collection ... cannot be resolved

See original GitHub issue

Please 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:

  1. Follow tutorial for react + express to create a repository (this worked at some point in the past, but now fails)
  2. Attempt to generate additional apps/libs from cli, for example nx generate @nrwl/node:library mylibrary
  3. 😭 --> Collection "@nrwl/node" cannot be resolved.

Path 2:

  1. Run npx create-nx-workspace@latest repro-workspace
    • react + express
    • emotion
  2. 😭 --> 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:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:5

github_iconTop GitHub Comments

4reactions
kooldandycommented, Aug 15, 2020

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.

0reactions
hadrien-tomacommented, Aug 19, 2020

This issue is closed as duplicate, please post your comments in the main one: #2953

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular - Collection "@candiman/website" cannot be resolved
So, physical collection.json is not present in the npm package folder and when schematics search for collection.json file it fails. Collection ...
Read more >
Collection "@igniteui/angular-schematics" cannot be resolved
angular-schematics error : Collection "@igniteui/angular-schematics" cannot be resolved | Infragistics Forums. then run command below, and got ...
Read more >
Schematics for libraries - Angular
To start a collection, you need to create the schematic files. The following steps show you how to add initial support without modifying...
Read more >
Eclipse Import - java Collections can not be resolved error ...
For me the "solution" was to add an "additional" JRE (Window > Preferences > Java > Installed JREs > Add) in Eclipse (version...
Read more >
angular-devkit/schematics - npm
Schematics can be referred by name inside a collection. Tool, The code using the Schematics library. Tree, A staging area for changes, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found