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

contributing from windows: 'patch' is not recognized as an internal or external command #54382

Closed
robertIsaac opened this issue Feb 11, 2024 · 3 comments

Comments

@robertIsaac
Copy link
Contributor

robertIsaac commented Feb 11, 2024

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

Yes

Description

this affects only windows contributors
in this file https://github.com/angular/angular/blob/main/aio/tools/cli-patches/patch.js#L11
the patch command isn't available in windows, and so it fails

steps to reproduce (in windows only)

  1. clone the project or run git clean -dfx
  2. cd to aio
  3. run yarn

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

PS C:\Users\rober\WebstormProjects\angular\aio> yarn
yarn install v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
$ node tools/cli-patches/patch.js && patch-package --patch-dir ../tools/npm-patches/
'patch' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\rober\WebstormProjects\angular\aio\node_modules\shelljs\src\common.js:401
      if (config.fatal) throw e;
                        ^

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

    at Object.error (C:\Users\rober\WebstormProjects\angular\aio\node_modules\shelljs\src\common.js:110:27)
    at execSync (C:\Users\rober\WebstormProjects\angular\aio\node_modules\shelljs\src\exec.js:120:12)
    at Object._exec (C:\Users\rober\WebstormProjects\angular\aio\node_modules\shelljs\src\exec.js:223:12)
    at Object.exec (C:\Users\rober\WebstormProjects\angular\aio\node_modules\shelljs\src\common.js:335:23)
    at C:\Users\rober\WebstormProjects\angular\aio\tools\cli-patches\patch.js:11:27
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (C:\Users\rober\WebstormProjects\angular\aio\tools\cli-patches\patch.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)

Node.js v18.16.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
PS C:\Users\rober\WebstormProjects\angular\aio> node tools/cli-patches/patch.js
'patch' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\rober\WebstormProjects\angular\aio\node_modules\shelljs\src\common.js:401
      if (config.fatal) throw e;
                        ^

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

    at Object.error (C:\Users\rober\WebstormProjects\angular\aio\node_modules\shelljs\src\common.js:110:27)
    at execSync (C:\Users\rober\WebstormProjects\angular\aio\node_modules\shelljs\src\exec.js:120:12)
    at Object._exec (C:\Users\rober\WebstormProjects\angular\aio\node_modules\shelljs\src\exec.js:223:12)
    at Object.exec (C:\Users\rober\WebstormProjects\angular\aio\node_modules\shelljs\src\common.js:335:23)
    at C:\Users\rober\WebstormProjects\angular\aio\tools\cli-patches\patch.js:11:27
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (C:\Users\rober\WebstormProjects\angular\aio\tools\cli-patches\patch.js:11:8)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)

Node.js v18.16.0

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 17.2.0-rc.0
Node: 18.16.0
Package Manager: yarn 1.22.19
OS: win32 x64

Angular: undefined
...

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1702.0-next.0
@angular-devkit/architect-cli   0.1702.0-next.0
@angular-devkit/build-angular   17.2.0-rc.0
@angular-devkit/core            17.2.0-rc.0
@angular-devkit/schematics      17.2.0-rc.0
@angular/animations             17.2.0-next.0
@angular/build-tooling          0.0.0-c83e99a12397014162531ca125c94549db55dd84
@angular/cdk                    17.2.0-rc.0
@angular/cli                    17.2.0-rc.0
@angular/docs                   0.0.0-c83e99a12397014162531ca125c94549db55dd84
@angular/material               17.2.0-rc.0
@angular/ng-dev                 <error>
@schematics/angular             17.2.0-rc.0
rxjs                            7.8.1
typescript                      5.3.2

Anything else?

workaround: run yarn from git bash
while it seems easy fix, the error happens when you run yarn test:ci and it's not obvious it's caused by failing yarn install or that running it from git bash will fix it

@JeanMeche
Copy link
Member

Hi,
As you mentionned, there workarounds : either use a gitbash or you can also run it in WSL.

Also, since we plan to deprecate angular.io in favor of angular.dev, we don't plan to work on the improving the tooling around AIO.

@JeanMeche JeanMeche closed this as not planned Won't fix, can't repro, duplicate, stale Feb 11, 2024
@robertIsaac
Copy link
Contributor Author

Hi, As you mentionned, there workarounds : either use a gitbash or you can also run it in WSL.

Also, since we plan to deprecate angular.io in favor of angular.dev, we don't plan to work on the improving the tooling around AIO.

could it be written at least that this only works from bash somewhere?

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants