postman-code-generators icon indicating copy to clipboard operation
postman-code-generators copied to clipboard

Failed to run yarn install on codegen csharp-httpclient

Open LoukaOctave opened this issue 1 year ago • 4 comments

Describe the bug

# This file contains the result of Yarn building a package (postman-code-generators@npm:1.12.0)
# Script name: postinstall

Detected package manager: yarn
Running pre-package script
Run successful languages.js saved in lib/assets
csharp-httpclient: yarn install --no-audit --production
Failed to run yarn install on codegen csharp-httpclient, here is the error:
csharp-restsharp: yarn install --no-audit --production
Failed to run yarn install on codegen csharp-restsharp, here is the error:
./node_modules/postman-code-generators/node_modules/async/dist/async.js:324
            if (fn === null) throw new Error("Callback was already called.");
                                   ^

Error: Callback was already called.
    at ./node_modules/postman-code-generators/node_modules/async/dist/async.js:324:36
    at ./node_modules/postman-code-generators/node_modules/async/dist/async.js:3646:17
    at ./node_modules/postman-code-generators/npm/deepinstall.js:59:16
    at Array.forEach (<anonymous>)
    at ./node_modules/postman-code-generators/npm/deepinstall.js:48:14
    at ./node_modules/postman-code-generators/node_modules/async/dist/async.js:3641:28
    at replenish (./node_modules/postman-code-generators/node_modules/async/dist/async.js:446:21)
    at iterateeCallback (./node_modules/postman-code-generators/node_modules/async/dist/async.js:430:21)
    at ./node_modules/postman-code-generators/node_modules/async/dist/async.js:327:20
    at ./node_modules/postman-code-generators/node_modules/async/dist/async.js:3646:17

Node.js v22.2.0

To Reproduce Steps to reproduce the behavior:

  1. Create the following package.json file
{
  "name": ".",
  "dependencies": {
    "postman-code-generators": "^1.12.0"
  },
  "packageManager": "[email protected]",
  "engines": {
    "node": ">=18.0"
  }
}

  1. Run yarn install

OR

  1. Run yarn add [email protected]

Expected code snippet and corresponding request N/A

Screenshots N/A

Additional context N/A

LoukaOctave avatar Jul 25 '24 09:07 LoukaOctave

Same with [email protected] for me.

sharky98 avatar Jul 25 '24 23:07 sharky98

Experiencing the same with Node.js v20.10.0 and [email protected].

Did anyone already have the chance to dig a little deeper and maybe found a workaround/solution to this problem?

renet avatar Aug 02 '24 08:08 renet

1.10.1 is the most recent version not affected by this

lpicchi avatar Aug 08 '24 20:08 lpicchi

Thanks! Using resolutions in the package.json worked for me:

"resolutions": {
  "postman-code-generators": "1.10.1"
}

But it might not work for special use cases, as stated here.

renet avatar Aug 09 '24 20:08 renet

Thanks all for reporting this issue! We'er working on fix for this and will inform here once the fix is available.

VShingala avatar Sep 10 '24 10:09 VShingala

Thank you everyone for reporting, This issue is now fixed. Please use the latest version v1.13.0.

aman-v-singh avatar Sep 16 '24 08:09 aman-v-singh

Still having an issue: my project is using pnpm but I have also yarn in the path so post install script fails with the following error

$ pnpm install
Scope: all 4 workspace projects
Lockfile is up to date, resolution step is skipped
Packages: +1032
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 0, reused 988, downloaded 0, added 1032, done
node_modules/postman-code-generators: Running postinstall script, failed in 3s
node_modules/postman-code-generators postinstall$ node npm/deepinstall.js
│ Detected package manager: yarn
│ Detected yarn version: 1.22.22
│ Running pre-package script
│ Run successful languages.js saved in lib/assets
│ csharp-httpclient: yarn install --production --frozen-lockfile
│ Failed to run yarn install on codegen csharp-httpclient, here is the error:
│ error This project's package.json defines "packageManager": "yarn@[email protected]". However the current global version o…
│ Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool include…
│ Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out htt…
│ csharp-restsharp: yarn install --production --frozen-lockfile
│ Failed to run yarn install on codegen csharp-restsharp, here is the error:
│ C:\Users\Jeff\work\src\github.com\containers\ai-lab\node_modules\async\dist\async.js:324
│             if (fn === null) throw new Error("Callback was already called.");
│                                    ^
│ Error: Callback was already called.
│     at C:\Users\Jeff\work\src\github.com\containers\ai-lab\node_modules\async\dist\async.js:324:36
│     at C:\Users\Jeff\work\src\github.com\containers\ai-lab\node_modules\async\dist\async.js:3646:17
│     at C:\Users\Jeff\work\src\github.com\containers\ai-lab\node_modules\postman-code-generators\npm\deepinstall.js:…
│     at Array.forEach (<anonymous>)
│     at C:\Users\Jeff\work\src\github.com\containers\ai-lab\node_modules\postman-code-generators\npm\deepinstall.js:…
│     at C:\Users\Jeff\work\src\github.com\containers\ai-lab\node_modules\async\dist\async.js:3641:28
│     at replenish (C:\Users\Jeff\work\src\github.com\containers\ai-lab\node_modules\async\dist\async.js:446:21)
│     at iterateeCallback (C:\Users\Jeff\work\src\github.com\containers\ai-lab\node_modules\async\dist\async.js:430:2…
│     at C:\Users\Jeff\work\src\github.com\containers\ai-lab\node_modules\async\dist\async.js:327:20
│     at C:\Users\Jeff\work\src\github.com\containers\ai-lab\node_modules\async\dist\async.js:3646:17
│ Node.js v20.17.0
└─ Failed in 3s at C:\Users\Jeff\work\src\github.com\containers\ai-lab\node_modules\postman-code-generators
 ELIFECYCLE  Command failed with exit code 1.

See also https://github.com/containers/podman-desktop-extension-ai-lab/pull/1827

jeffmaury avatar Oct 03 '24 14:10 jeffmaury

Also still experiencing this issue with 1.14.0

MorelSerge avatar Nov 11 '24 10:11 MorelSerge

  • @jeffmaury Check if this issue can be solved by using the corepack enable command in your terminal before installation. This issue is caused by a possible conflict between the environment package manager and the system package manager.

Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool include… Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out htt…

aman-v-singh avatar Nov 11 '24 14:11 aman-v-singh

@MorelSerge, Can you please share more about your issue, such as the error message, package manager, package manager version number, etc.?

aman-v-singh avatar Nov 11 '24 14:11 aman-v-singh

@MorelSerge, Can you please share more about your issue, such as the error message, package manager, package manager version number, etc.?

Sure! I've been running 1.10.0 without issues at the moment. Upgrading to 1.14.0 fails to install due to the error below. Seem to detect yarn somehow, instead of pnpm?

Package manager = pnpm 9.12.3 Monorepo setup with Turborepo Node 22.1.0

Details

../../node_modules/.pnpm/[email protected]/node_modules/postman-code-generators: Running postinstall scrip../../node_modules/.pnpm/[email protected]/node_modules/postman-code-generators: Running postinstall script, failed in 850ms
.../node_modules/postman-code-generators postinstall$ node npm/deepinstall.js
│ Detected package manager: yarn
│ Detected yarn version: 1.22.21
│ Running pre-package script
│ Run successful languages.js saved in lib/assets
│ csharp-httpclient: yarn install --production --frozen-lockfile
│ Failed to run yarn install on codegen csharp-httpclient, here is the error:
│ error This project's package.json defines "packageManager": "yarn@[email protected]". However the current global version…
│ Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool includ…
│ Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out ht…
│ csharp-restsharp: yarn install --production --frozen-lockfile
│ Failed to run yarn install on codegen csharp-restsharp, here is the error:
│ /Users/X/X/X/node_modules/.pnpm/[email protected]/node_modules/async/dist/async.js:324
│             if (fn === null) throw new Error("Callback was already called.");
│                                    ^
│ Error: Callback was already called.
│     at /Users/X/X/X/node_modules/.pnpm/[email protected]/node_modules/async/dist/async.js:324:36
│     at /Users/X/X/X/node_modules/.pnpm/[email protected]/node_modules/async/dist/async.js:3646:17
│     at /Users/X/X/X/node_modules/.pnpm/[email protected]/node_modules/postman-cod…
│     at Array.forEach (<anonymous>)
│     at /Users/X/X/X/node_modules/.pnpm/[email protected]/node_modules/postman-cod…
│     at /Users/X/X/X/node_modules/.pnpm/[email protected]/node_modules/async/dist/async.js:3641:28
│     at replenish (/Users/X/X/X/node_modules/.pnpm/[email protected]/node_modules/async/dist/async.js…
│     at iterateeCallback (/Users/X/X/X/node_modules/.pnpm/[email protected]/node_modules/async/dist/a…
│     at /Users/X/X/X/node_modules/.pnpm/[email protected]/node_modules/async/dist/async.js:327:20
│     at /Users/X/X/X/node_modules/.pnpm/[email protected]/node_modules/async/dist/async.js:3646:17
│ Node.js v22.1.0
└─ Failed in 850ms at /Users/X/X/X/node_modules/.pnpm/[email protected]/node_modules/postman-code-generators
 ELIFECYCLE  Command failed with exit code 1.

MorelSerge avatar Nov 13 '24 12:11 MorelSerge

@MorelSerge, check if this issue can be solved by using the corepack enable command on your terminal before installation.

aman-v-singh avatar Nov 15 '24 09:11 aman-v-singh

Hey @jeffmaury @MorelSerge , Are you still having this issue after the suggested resolution?

aman-v-singh avatar Nov 19 '24 08:11 aman-v-singh

Hey @jeffmaury @MorelSerge , Are you still having this issue after the suggested resolution?

Apologies for the delay here. I've run corepack enable and tried reinstalling with pnpm i and the issue is resolved.

Thank you

MorelSerge avatar Nov 23 '24 14:11 MorelSerge