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

Error: 'les' is not recognized as an internal or external command, operable program or batch file. #21742

Closed
1 of 4 tasks
esthrim opened this issue Feb 9, 2024 · 4 comments · Fixed by #29122
Closed
1 of 4 tasks
Assignees
Labels
os: windows Issues that can only be replicated on Windows scope: misc Misc issues stale type: bug

Comments

@esthrim
Copy link

esthrim commented Feb 9, 2024

Current Behavior

When I run this command on windows command prompt :
npx create-nx-workspace --pm pnpm

it's giving me this error :
` NX Failed to create a workspace.

Error: 'les' is not recognized as an internal or external command,
operable program or batch file.

I try also the second time now the error is :

` NX Failed to create a workspace.

Error: 'odules' is not recognized as an internal or external command,
operable program or batch file.`

I'm using pnpm version 8.15.1, nodejs version 20.11.0 and windows 11 without wsl

maybe there is something broken command or text in the windows environment ?
Screenshot 2024-02-09 135210

Expected Behavior

it suppose to generate the workspace successfully

GitHub Repo

No response

Steps to Reproduce

npx create-nx-workspace --pm pnpm

Nx Report

>  NX   Failed to create a workspace.

   Error: 'les' is not recognized as an internal or external command,
operable program or batch file.

Failure Logs

>  NX   Failed to create a workspace.

   Error: 'les' is not recognized as an internal or external command,
operable program or batch file.

Package Manager Version

No response

Operating System

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

Additional Information

No response

@esthrim
Copy link
Author

esthrim commented Feb 9, 2024

image

@AgentEnder AgentEnder added scope: misc Misc issues os: windows Issues that can only be replicated on Windows labels Feb 16, 2024
@joelpelaez
Copy link
Contributor

I have the same issue, I tried using create-nx-workspace with react preset and create a empty monorepo and add @nx/react and @nx/workspace after that, but is the same issue.

Using the command npx nx g @nx/workspace:preset --name=main3 --preset=react-monorepo --e2eTestRunner=none --bundler=vite

This only happens with pnpm.

I checked if some packages that @nx/react installs are present before execute the generator the command is executed successfully.

If them are not preset outputs something like that:

C:\Users\user\source\repos\nx\tmp\org1>_modules;C:\Users\user\source\repos\nx\tmp\org1\node_modules\.pnpm\node_modules;C:\Users\user\source\repos\nx\tmp\org1\node_modules\.pnpm\[email protected]\node_modules\nx\bin\node_modules;C:\Users\user\source\repos\nx\tmp\org1\node_modules\.pnpm\[email protected]\node_modules\nx\node_modules;C:\Users\user\source\repos\nx\tmp\org1\node_modules\.pnpm\[email protected]\node_modules;C:\Users\user\source\repos\nx\tmp\org1\node_modules\.pnpm\node_modules"
"_modules" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.

The package @swc-node/register is also involved in this issue, If this package is removed and react preset is executed throws this log:

C:\Users\user\source\repos\nx\tmp\org1>C:\Users\user\source\repos\nx\tmp\org1\node_modules\.bin\\node.exe" (
"C:\Users\user\source\repos\nx\tmp\org1\node_modules\.bin\\node.exe" (" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.

C:\Users\user\source\repos\nx\tmp\org1>"C:\Users\user\source\repos\nx\tmp\org1\node_modules\.bin\\node.exe"  "C:\Users\user\source\repos\nx\tmp\org1\node_modules\.bin\\..\nx\bin\nx.js" "g" "@nx/workspace:preset" "--name=main3" "--preset=react-monorepo" "--e2eTestRunner=none" "--bundler=vite"
""C:\Users\user\source\repos\nx\tmp\org1\node_modules\.bin\\node.exe"" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.

C:\Users\user\source\repos\nx\tmp\org1>node  "C:\Users\user\source\repos\nx\tmp\org1\node_modules\.bin\\..\nx\bin\nx.js" "g" "@nx/workspace:preset" "--name=main3" "--preset=react-monorepo" "--e2eTestRunner=none" "--bundler=vite"

and retries to execute the command again.

But if the command is executed directly using node:

node  "C:\Users\user\source\repos\nx\tmp\org1\node_modules\.bin\\..\nx\bin\nx.js" "g" "@nx/workspace:preset" "--name=main3" "--preset=react-monorepo" "--e2eTestRunner=none" "--bundler=vite"

The error doesn't happen.

I tried to check the cmd.exe calls and intercept them using COMSPEC environment variable but I cannot get information about the caller. cmd.exe can be called directly or some part of pnpm process is executed by cmd.exe

This sees similar to this issue pnpm/pnpm#7181 . But I cannot confirm if pnpm is the real curprit.

@BensEye
Copy link

BensEye commented Jun 3, 2024

image

Similar issue here.
Attempted to install with npx create-nx-workspace@latest --preset=next --pm pnpm.

Copy link

github-actions bot commented Dec 1, 2024

This issue has been automatically marked as stale because it hasn't had any activity for 6 months.
Many things may have changed within this time. The issue may have already been fixed or it may not be relevant anymore.
If at this point, this is still an issue, please respond with updated information.
It will be closed in 21 days if no further activity occurs.
Thanks for being a part of the Nx community! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os: windows Issues that can only be replicated on Windows scope: misc Misc issues stale type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants