nx: Create a New Workspace failed

Please make sure you have read the submission guidelines before posting an issue

Prerequisites

Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • I am running the latest version
  • I checked the documentation (nx.dev) and found no answer
  • I checked to make sure that this issue has not already been filed
  • I’m reporting the issue to the correct repository (not related to React, Angular or any dependency)

Expected Behavior

nx workspace

Current Behavior

nx workspace, not creating

Failure Information (for bugs)

Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. npx create-nx-workspace@latest

Context

Please provide any relevant information about your setup:

  • NX version: latest

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.

Failure Logs

Creating a sandbox with Nx...
warning " > @nrwl/workspace@9.2.2" has incorrect peer dependency "prettier@^1.19.1".
[---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 0/366
new live-test --preset="empty" --interactive=false --collection=@nrwl/workspace
Collection "@nrwl/workspace" cannot be resolved.
(node:4646) UnhandledPromiseRejectionWarning: Error: Command failed: "/var/folders/8q/687g4zrx7ddcrhx81vymjj8r0000gn/T/tmp-46466Q2AoD5j1UTy/node_modules/.bin/tao" new live-test --preset="empty" --interactive=false --collection=@nrwl/workspace
    at checkExecSyncError (child_process.js:621:11)
    at Object.execSync (child_process.js:658:15)
    at createApp (/Users/mac/.npm/_npx/4646/lib/node_modules/create-nx-workspace/bin/create-nx-workspace.js:343:21)
    at /Users/mac/.npm/_npx/4646/lib/node_modules/create-nx-workspace/bin/create-nx-workspace.js:76:21
    at processTicksAndRejections (internal/process/task_queues.js:89:5)
(node:4646) 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:4646) [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

Any other relevant information that will help us help you.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (3 by maintainers)

Most upvoted comments

I’m going to close this issue, folks. The issue should be resolved.

Having the same issue. First time trying nx, following along with the tutorial, nx failing at step 1.

andrea@nomad Desktop % npm create nx-workspace
? Workspace name (e.g., org name)     test
? What to create in the new workspace react             [a workspace with a sing
le React application]
? Application name                    todos
? Default stylesheet format           CSS
Creating a sandbox with Nx...
warning " > @nrwl/workspace@9.2.3" has incorrect peer dependency "prettier@^1.19.1".
[#####################################################################] 366/366
new test --preset="react" --appName="todos" --style="css" --interactive=false --collection=@nrwl/workspace
(node:20186) UnhandledPromiseRejectionWarning: Error [ERR_INVALID_PACKAGE_TARGET]: Invalid "exports" main target "index.js" defined in the package config /private/var/folders/7n/q8l936kj3y9fdjn0h7mbgll40000gn/T/tmp-57423bz5EQvNa9xfI/node_modules/is-promise/package.json
    at resolveExportsTarget (internal/modules/cjs/loader.js:542:13)
    at resolveExportsTarget (internal/modules/cjs/loader.js:581:20)
    at applyExports (internal/modules/cjs/loader.js:455:14)
    at resolveExports (internal/modules/cjs/loader.js:508:23)
    at Function.Module._findPath (internal/modules/cjs/loader.js:632:31)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1001:27)
    at Function.Module._load (internal/modules/cjs/loader.js:884:27)
    at Module.require (internal/modules/cjs/loader.js:1074:19)
    at Module.require (/private/var/folders/7n/q8l936kj3y9fdjn0h7mbgll40000gn/T/tmp-57423bz5EQvNa9xfI/node_modules/@nrwl/tao/src/compat/compat.js:4:36)
    at require (internal/modules/cjs/helpers.js:72:18)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:20186) 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: 1)
(node:20186) [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.

———————————————————————————————————————————————


>  NX   NOTE  We generated an Nx workspace powered by the Nx CLI.

  Run 'create-nx-workspace --help' to see how to select a different CLI.


———————————————————————————————————————————————


>  NX   NOTE  Nx CLI is not installed globally.

  This means that you might have to use "yarn nx" or "npm nx" to execute commands in the workspace.
  Run "yarn global add @nrwl/cli" or "npm install -g @nrwl/cli" to be able to execute command directly.


———————————————————————————————————————————————


>  NX   NOTE  First time using Nx? Check out this interactive Nx tutorial.

  https://nx.dev/react/tutorial/01-create-application

  Prefer watching videos? Check out this free Nx course on YouTube.
  https://www.youtube.com/watch?v=2mYLe9Kp9VM&list=PLakNactNC1dH38AfqmwabvOszDmKriGco

andrea@nomad Desktop %

I tried all the following with same results:

  • npx create-nx-workspace@latest
  • npx create-nx-workspace@latest --ignore-existing
  • yarn create nx-workspace

Env:

  • node: v12.16.1 (npm v6.13.4) and v14.0.0 (npm v6.14.4)
  • node version manager: asdf v0.7.8-4a3e3d6
  • yarn v1.22.4

@jaysoo

  • with the --ignore-existing option getting the same error
  • /Users/mac/.npm/_npx that directory is empty

NB: npx create-nx-workspace@8.7.0 just working fine here

I have the same issue again

npm init nx-workspace --ignore-existing

npx: installed 240 in 17.228s
? Workspace name (e.g., org name)     myeditor
? What to create in the new workspace empty             [an empty workspace with a layout that works best for building apps]
? Use Nx Cloud? (It's free and doesn't require registration.) Yes [Faster builds, run details, Github integration. Learn more at https://nx.app]
Creating a sandbox with Nx...
added 240 packages from 232 contributors and audited 241 packages in 15.957s

29 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

new myeditor --ignoreExisting --no-interactive --preset=empty --appName= --linter=eslint --nxCloud --collection=@nrwl/workspace
Cannot generate a new workspace within an existing workspace
(node:50933) UnhandledPromiseRejectionWarning: Error: Command failed: npx tao new surveyanyplace-editor --ignoreExisting --no-interactive --preset=empty --appName= --linter=eslint --nxCloud --collection=@nrwl/workspace/collection.json --cli=nx --nxWorkspaceRoot="/Users/sa-emery/Documents/dev/survey-editor"
    at checkExecSyncError (child_process.js:616:11)
    at Object.execSync (child_process.js:652:15)
    at createApp (/Users/sa-emery/.npm/_npx/50930/lib/node_modules/create-nx-workspace/bin/create-nx-workspace.js:380:21)
    at /Users/sa-emery/.npm/_npx/50930/lib/node_modules/create-nx-workspace/bin/create-nx-workspace.js:97:29
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:50933) 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: 1)
(node:50933) [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.

Running npm 6.14.10, Node v14.15.4, nx/Angular CLI 11.1.0

I think this error should be fixed. We now use an absolute path to resolve the collection. Could you try again with the latest version of 9x or 10x?

8.7.0 didn’t work for me. Could just be a yarn thing. Ended up doing something else. cp -a’d over an old workspace and gutted out

On Tue, Apr 21, 2020 at 7:35 PM Shakil Ahmed notifications@github.com wrote:

I’ve worked on previously with 8.7.0 and that’s why instead of the latest I just tried with that old version. And in my case, it’s working.

I just said whats the scenario on my environment, didn’t give a solution. Why the downvote @CharlieGreenman https://github.com/CharlieGreenman may I know?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nrwl/nx/issues/2852#issuecomment-617269433, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBE73IOTSM3RHTHCPW2KBLRNXDMZANCNFSM4MGYFECA .

– All and only the best, Charlie Greenman Founder and UI / Compiler Architect

I’ve worked on previously with 8.7.0 and that’s why instead of the latest I just tried with that old version. And in my case, it’s working.

I just said whats the scenario on my environment, didn’t give a solution. Why the downvote @CharlieGreenman may I know?