Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug "nx init" script on Windows #27331

Closed
1 of 4 tasks
sacru2red opened this issue Aug 8, 2024 · 2 comments
Closed
1 of 4 tasks

bug "nx init" script on Windows #27331

sacru2red opened this issue Aug 8, 2024 · 2 comments
Assignees
Labels

Comments

@sacru2red
Copy link

sacru2red commented Aug 8, 2024

Current Behavior

nx init fails

Expected Behavior

no errors

GitHub Repo

No response

Steps to Reproduce

  1. run nx init on windows

Nx Report

NX   Report complete - copy this into the issue template

Node           : 20.15.1
OS             : win32-x64
Native Target  : x86_64-windows
npm            : 10.7.0

nx (global)    : 19.5.7
nx             : 19.5.7
@nx/js         : 19.5.7
@nx/linter     : 19.5.7
@nx/eslint     : 19.5.7
@nx/workspace  : 19.5.7
@nx/devkit     : 19.5.7
@nrwl/tao      : 19.5.7
typescript     : 5.4.5

Failure Logs

$ nx init
Setting Nx up installation in `.nx`. You can run Nx commands like: `./nx.bat --help`

 NX   Recommended Plugins:

Add these Nx plugins to integrate with the tools used in your workspace.

√ Which plugins would you like to add? Press <Space> to select and <Enter> to submit. · @nx/eslint, @nx/webpack, @nx/jest, @nx/next
'.'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는
배치 파일이 아닙니다.
nx init

Adds Nx to any type of workspace. It installs nx, creates an nx.json configuration file and optionally sets up remote caching. For more
info, check https://nx.dev/recipes/adopting-nx.

Options:
  --help                  Show help                                                                                           [boolean]
  --version               Show version number                                                                                 [boolean]
  --nxCloud               Set up distributed caching with Nx Cloud.                                                           [boolean]
  --interactive           When false disables interactive input prompts for options.                          [boolean] [default: true]
  --useDotNxInstallation  Initialize an Nx workspace setup in the .nx directory of the current repository.   [boolean] [default: false]

Error: Command failed: ./nx add @nx/eslint
    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at checkExecSyncError (node:child_process:890:11)
    at execSync (node:child_process:962:15)
    at C:\Users\...\node_modules\nx\src\command-line\init\init-v2.js:36:42
    at Array.forEach (<anonymous>)
    at Object.initHandler (C:\Users\...\node_modules\nx\src\command-line\init\init-v2.js:35:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.handler (C:\Users\...\node_modules\nx\src\command-line\init\command-object.js:14:13) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 22232,
  stdout: null,
  stderr: null
}

Package Manager Version

[email protected]

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

execSync(`./nx add ${plugin}`, {

fix to

(0, child_process_2.execSync)(`.\\nx add ${plugin}`, {
                stdio: 'inherit',
            });

like

baseCmd = '.\\' + join(`${offsetFromRoot}`, 'nx.bat');

ps.
It is not related to this issue, but in my personal opinion, it would be better to check if package.json exists before running the init script, and if not, warn and exit.

@AgentEnder AgentEnder self-assigned this Aug 9, 2024
@AgentEnder AgentEnder added the scope: core core nx functionality label Aug 9, 2024
@AgentEnder
Copy link
Member

Fixed in #27364

Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants