Closed niklissad closed 3 years ago
If I am not mistaken, nx uses yarn workspaces
so this would not be a bug but by design.
Hi @niklissad
I'm having trouble reproducing the issue. I have uninstalled yarn
from my system and Could you please provide more context about the error you are seeing (i.e. Please copy the command run and the entire output of the command.)? It would really help me reproduce and investigate the issue.
Also, could you please provide the output of the following commands?
nx config --global cli.packageManager
ng config --global cli.packageManager
Here's my output:
jason@pop-os ~/p/t/n/create-test> yarn --version
Command 'yarn' not found, but can be installed with:
sudo apt install cmdtest
jason@pop-os ~/p/t/n/create-test [127]> npm init nx-workspace@latest test4
npx: installed 181 in 8.229s
package manager: npm <= Added this logging
? What to create in the new workspace angular [a workspace with a single Angular application]
? Application name app1
? Default stylesheet format SASS(.scss) [ http://sass-lang.com ]
? 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 193 packages from 153 contributors in 2.971s
21 packages are looking for funding
run `npm fund` for details
new test4 --preset="angular" --appName="app1" --style="scss" --linter="tslint" --interactive=false --collection=@nrwl/workspace
✔ Packages installed successfully.
[Omitted a bunch of files created]
✔ Packages installed successfully.
✔ Packages installed successfully.
Successfully initialized git.
[Omitted a bunch of files being created and Tutorial info]
jason@pop-os ~/p/t/n/create-test> nx config --global cli.packageManager
> NX The current directory isn't part of an Nx workspace.
To create a workspace run:
npx create-nx-workspace@latest <workspace name>
> NX NOTE For more information please visit https://nx.dev/
jason@pop-os ~/p/t/n/create-test [1]> ng config --global cli.packageManager
Value cannot be found.
jason@pop-os ~/p/t/n/create-test [1]>
@Jamesdinnes Sorry, you are mistaken.. Nx does not use yarn workspaces
. They can be used together but by default, Nx does not use yarn workspaces
or strictly depend on yarn
. It is definitely intended that Nx works with only npm
installed and not yarn
. Sorry for the confusion.
I also encountered the same problem when trying to create nx workspace.
And my output:
~/projects via ⬢ v14.15.0
❯ npm init nx-workspace@latest
? Workspace name (e.g., org name) myorg2
? What to create in the new workspace angular-nest [a workspace with a full stack application (Angular + Nest)]
? Application name myapp
? Default stylesheet format CSS
? Default linter ESLint [ Modern linting tool ]
? 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...
new myorg2 --preset="angular-nest" --appName="myapp" --style="css" --linter="eslint" --nxCloud --interactive=false --collection=@nrwl/workspace
- Installing packages...'yarn' is not recognized as an internal or external command,
operable program or batch file.
× Package install failed, see above.
The Schematic workflow failed. See above.
npm ERR! code 1
npm ERR! path C:\Users\WANGZI~1.COR\AppData\Local\Temp\tmp-21752cxxxSMyBjJ7J
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c "tao "new" "myorg2" "--preset=angular-nest" "--appName=myapp" "--style=css" "--linter=eslint" "--nxCloud" "--interactive=false" "--collection=C:\Users\WANGZI~1.COR\AppData\Local\Temp\tmp-21752cxxxSMyBjJ7J\node_modules\@nrwl\workspace\collection.json" "--cli=ng" "--nxWorkspaceRoot=C:\Users\wangzishi.CORP\projects""
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\wangzishi.CORP\AppData\Local\npm-cache\_logs\2020-10-28T09_49_47_295Z-debug.log
(node:21752) UnhandledPromiseRejectionWarning: Error: Command failed: npx tao new myorg2 --preset="angular-nest" --appName="myapp" --style="css" --linter="eslint" --nxCloud --interactive=false --collection=C:\Users\WANGZI~1.COR\AppData\Local\Temp\tmp-21752cxxxSMyBjJ7J\node_modules\@nrwl\workspace\collection.json --cli=ng --nxWorkspaceRoot=C:\Users\wangzishi.CORP\projects
at checkExecSyncError (child_process.js:616:11)
at Object.execSync (child_process.js:652:15)
at createApp (C:\Users\wangzishi.CORP\AppData\Local\npm-cache\_npx\505743838affa773\node_modules\create-nx-workspace\bin\create-nx-workspace.js:424:21)
at C:\Users\wangzishi.CORP\AppData\Local\npm-cache\_npx\505743838affa773\node_modules\create-nx-workspace\bin\create-nx-workspace.js:92:29
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:21752) 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:21752) [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.
~/projects via ⬢ v14.15.0 took 40s
❯ yarn
yarn: The term 'yarn' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
~/projects via ⬢ v14.15.0
❯ ng config --global cli.packageManager
Value cannot be found.
~/projects via ⬢ v14.15.0
❯ nx config --global cli.packageManager
> NX The current directory isn't part of an Nx workspace.
To create a workspace run:
npx create-nx-workspace@latest <workspace name>
> NX NOTE For more information please visit https://nx.dev/
~/projects via ⬢ v14.15.0
❯
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏
Since v10.4 the we default to NPM, unless --package-manager
flag is used when creating a new workspace. I suppose this will solve your issue, but feel free to reopen in case there is a problem.
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
I tried to create new nx workspace with and get error. If I use
npm
for creating workspace I really don't need have Yarn on my system to work withnpm
Current Behavior
Workspace didn't created
Expected Behavior
Workspace created
Steps to Reproduce
Run
npm init nx-workspace
without Yarn installed in systemFailure Logs
⠋ Installing packages.../bin/sh: yarn: command not found
Environment
Mac OS X