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

Postinstall fails on pnpm fetch #5928

Closed
Leksat opened this issue Aug 7, 2023 · 3 comments
Closed

Postinstall fails on pnpm fetch #5928

Leksat opened this issue Aug 7, 2023 · 3 comments
Labels
type: bug code to address defects in shipped code

Comments

@Leksat
Copy link

Leksat commented Aug 7, 2023

Describe the bug

Latest version of netlify-cli fails on postinstall with pnpm fetch

$ pnpm fetch
...
.../node_modules/netlify-cli postinstall$ node ./scripts/postinstall.mjs
│ node:internal/modules/cjs/loader:1077
│   const err = new Error(message);
│               ^
│ Error: Cannot find module '@opentelemetry/core'
...

Steps to reproduce

Repro: https://github.com/Leksat/netlify-cli-pnpm-fetch
Actions: https://github.com/Leksat/netlify-cli-pnpm-fetch/blob/main/.github/workflows/test.yml
Result: https://github.com/Leksat/netlify-cli-pnpm-fetch/actions/runs/5781917546/job/15667786482

Configuration

No response

Environment

Local env:

  System:
    OS: macOS 13.5
    CPU: (12) arm64 Apple M2 Pro
    Memory: 128.36 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.17.0 - ~/.nvm/versions/node/v18.17.0/bin/node
    Yarn: 1.22.19 - ~/Library/pnpm/yarn
    npm: 9.6.7 - ~/.nvm/versions/node/v18.17.0/bin/npm
    pnpm: 8.6.12 - ~/.nvm/versions/node/v18.17.0/bin/pnpm

But the issue happens on Linux as well.

@Leksat Leksat added the type: bug code to address defects in shipped code label Aug 7, 2023
@Leksat Leksat changed the title Please replace with a clear and descriptive title Postinstall fails on pnpm fetch Aug 7, 2023
@Leksat
Copy link
Author

Leksat commented Aug 7, 2023

According to my local tests, the issue was introduced in https://github.com/netlify/cli/releases/tag/v15.8.0

dgp1130 added a commit to dgp1130/netlify-build that referenced this issue Aug 19, 2023
This adds an undeclared dependency on @opentelemetry/core which fixes pnpm users of @netlify/build.

See: honeycombio/honeycomb-opentelemetry-node#207

Fixes netlify/cli#5928
@dgp1130
Copy link

dgp1130 commented Aug 19, 2023

Ran into this myself today trying to use netlify-cli with pnpm and hoist=false. The root cause is that @honeycombio/opentelemetry-node@0.4.0 had an undeclared dependency on @opentelemetry/core. This was fixed in honeycombio/honeycomb-opentelemetry-node#207 and released in v0.5.0. I'm pretty sure the right action here is just to bump the dependency in @netlify/build. I made netlify/build#5247 with the fix.

In the mean time, the easiest workaround in pnpm is to use packageExtensions to add the undeclared dependency to your package.json file.

{
    "pnpm": {
        "packageExtensions": {
            "@honeycomb/opentelemetry-node": {
                "dependencies": {
                    "@opentelemetry/core": "*"
                }
            }
        }
    }
}

@JGAntunes
Copy link
Contributor

Hey folks 👋 Apologies for taking so long to tackle this one but I think this has been addressed with the latest CLI release - https://github.com/netlify/cli/blob/main/CHANGELOG.md#17131-2024-01-11

This packs - netlify/build#5446 - which takes care of removing most of our OTEL dependencies from build execept for the OTEL API.

Feel free to re-open if this doesn't fix it for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants