Collection "@nrwl/workspace" cannot be resolved.
See original GitHub issuePrerequisites
Expected Behavior
Have the following command working:
npx create-nx-workspace workspace --cli=angular --npm-scope=scope --preset=empty --skipGit=true --style=scss
Current Behavior / Failure Information (for bugs)
An unhandled exception occurred: Collection "@nrwl/workspace" cannot be resolved.
Steps to Reproduce
~/workspaces $ mkdir tmp
~/workspaces $ cd tmp/
~/workspaces/tmp $ npx create-nx-workspace workspace --cli=angular --npm-scope=scope --preset=empty --skipGit=true --style=scss
Context
~/workspaces/tmp $ yarn --version
1.22.4
~/workspaces/tmp $ node --version
v14.1.0
~/workspaces/tmp $ npm --version
6.14.4
~/workspaces/tmp $ uname -a
Linux nx--tools--dev--nx--latest-gkr8k 4.19.107 #1 SMP Thu Mar 26 11:33:10 PDT 2020 x86_64 Linux
~/workspaces/tmp $ cat /proc/version
Linux version 4.19.107 (jenkins@jenkins) (gcc version 7.4.0 (Buildroot 2019.02.10)) #1 SMP Thu Mar 26 11:33:10 PDT 2020
~/workspaces/tmp $ lsb_release -a
sh: lsb_release: not found
~/workspaces/tmp $ cat /etc/*release
3.11.6
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.11.6
PRETTY_NAME="Alpine Linux v3.11"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
Failure Logs
npx: installed 198 in 34.148s
Creating a sandbox with Nx...
warning @angular/cli > universal-analytics > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning " > @nrwl/workspace@9.2.3" has incorrect peer dependency "prettier@^1.19.1".
new workspace "--npm-scope=scope" "--skipGit=true" --preset="empty" --interactive=false --collection=@nrwl/workspace
An unhandled exception occurred: Collection "@nrwl/workspace" cannot be resolved.
See "/tmp/ng-ahJOFF/angular-errors.log" for further details.
(node:847) UnhandledPromiseRejectionWarning: Error: Command failed: "/tmp/tmp-84746viJAJvJms6/node_modules/.bin/ng" new workspace "--npm-scope=scope" "--skipGit=true" --preset="empty" --interactive=false --collection=@nrwl/workspace
at checkExecSyncError (child_process.js:611:11)
at Object.execSync (child_process.js:647:15)
at createApp (/home/node/.npm/_npx/847/lib/node_modules/create-nx-workspace/bin/create-nx-workspace.js:343:21)
at /home/node/.npm/_npx/847/lib/node_modules/create-nx-workspace/bin/create-nx-workspace.js:76:21
(Use `node --trace-warnings ...` to show where the warning was created)
(node:847) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:847) [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.
Other
- It was working for a while so it may be linked to new changes.
- There was an issue about it in the past: https://github.com/nrwl/nx/issues/1499
Issue Analytics
- State:
- Created 3 years ago
- Reactions:13
- Comments:42 (6 by maintainers)
Top Results From Across the Web
Nx generate get 'Collection "@nrwl/storybook" cannot be ...
The command is correct. Try run npm i @nrwl/storybook or yarn add @nrwl/storybook first and retry.
Read more >@nrwl/workspace - npm
The Workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and ......
Read more >nrwl-nx/community - Gitter
I have a simple usecase that I can't seem to grok by studying the nx docs. ... --collection=@nrwl/workspace ✓ Packages installed successfully.
Read more >Add and Debug Schematic Projects in an Angular Workspace
If you are using the schematics collection from the ... cannot be resolved. ... Create a new workspace using Nrwl.io Nx schematics.
Read more >Migrating an Angular CLI project to Nx
The nx , @nrwl/workspace and prettier packages will be installed. An nx.json file will be created in the root of your workspace. A...
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 have run into this error while trying to follow the Nx migration guide to bring a react app into Nx: https://nx.dev/react/migration/overview
I was able to run
npx create-nx-workspace@latest
and create an empty workspace. The next suggested command failsnx generate @nrwl/react:application my-application
with “Collection “@nrwl/react” cannot be resolved.”Running
npm install @nrwl/react
seems to have resolved the problem. Perhaps consider adding this to the tutorial ifnx generate @nrwl/react:application
is unable to install its own dependencies.Thanks a lot. it worked. i wonder why there is no mentions on this for empty workspaces.