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

Package generation fails in Ubuntu using Node.js v18 #315

Open
andylamp opened this issue Nov 11, 2023 · 2 comments
Open

Package generation fails in Ubuntu using Node.js v18 #315

andylamp opened this issue Nov 11, 2023 · 2 comments
Labels
wontfix This will not be worked on

Comments

@andylamp
Copy link

The issue I am having is quite peculiar, in certain Ubuntu installations open-next package fails to compile with the following bizarre error during the server function generation,

┌──────────────────────────────┐
│ OpenNext — Generating bundle │
└──────────────────────────────┘

Bundling static assets...
Bundling cache assets...
Bundling server function...
✘ [ERROR] Could not resolve "@aws-sdk/client-dynamodb"

    node_modules/open-next/dist/adapters/server-adapter.js:2:31:
      2 │ import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
        ╵                                ~~~~~~~~~~~~~~~~~~~~~~~~~~

  The Yarn Plug'n'Play manifest forbids importing "@aws-sdk/client-dynamodb" here because it's not
  listed as a dependency of this package:

    ../../.pnp.cjs:86:31:
      86 │         "packageDependencies": [\
         ╵                                ~~

  You can mark the path "@aws-sdk/client-dynamodb" as external to exclude it from the bundle, which
  will remove this error.

✘ [ERROR] Could not resolve "@aws-sdk/client-s3"

    node_modules/open-next/dist/adapters/server-adapter.js:3:25:
      3 │ import { S3Client } from "@aws-sdk/client-s3";
        ╵                          ~~~~~~~~~~~~~~~~~~~~

  The Yarn Plug'n'Play manifest forbids importing "@aws-sdk/client-s3" here because it's not listed
  as a dependency of this package:

    ../../.pnp.cjs:86:31:
      86 │         "packageDependencies": [\
         ╵                                ~~

  You can mark the path "@aws-sdk/client-s3" as external to exclude it from the bundle, which will
  remove this error.

✘ [ERROR] Could not resolve "@aws-sdk/client-sqs"

    node_modules/open-next/dist/adapters/plugins/routing/util.js:1:46:
      1 │ import { SendMessageCommand, SQSClient } from "@aws-sdk/client-sqs";
        ╵                                               ~~~~~~~~~~~~~~~~~~~~~

  The Yarn Plug'n'Play manifest forbids importing "@aws-sdk/client-sqs" here because it's not listed
  as a dependency of this package:

    ../../.pnp.cjs:86:31:
      86 │         "packageDependencies": [\
         ╵                                ~~

  You can mark the path "@aws-sdk/client-sqs" as external to exclude it from the bundle, which will
  remove this error.

/home/myuser/open-next-project/node_modules/esbuild/lib/main.js:1649
  let error = new Error(text);
              ^

Error: Build failed with 3 errors:
node_modules/open-next/dist/adapters/plugins/routing/util.js:1:46: ERROR: Could not resolve "@aws-sdk/client-sqs"
node_modules/open-next/dist/adapters/server-adapter.js:2:31: ERROR: Could not resolve "@aws-sdk/client-dynamodb"
node_modules/open-next/dist/adapters/server-adapter.js:3:25: ERROR: Could not resolve "@aws-sdk/client-s3"
    at failureErrorWithLog (/home/myuser/open-next-project/node_modules/esbuild/lib/main.js:1649:15)
    at /home/myuser/open-next-project/node_modules/esbuild/lib/main.js:1058:25
    at /home/myuser/open-next-project/node_modules/esbuild/lib/main.js:1003:52
    at buildResponseToResult (/home/myuser/open-next-project/node_modules/esbuild/lib/main.js:1056:7)
    at /home/myuser/open-next-project/node_modules/esbuild/lib/main.js:1085:16
    at responseCallbacks.<computed> (/home/myuser/open-next-project/node_modules/esbuild/lib/main.js:703:9)
    at handleIncomingPacket (/home/myuser/open-next-project/node_modules/esbuild/lib/main.js:762:9)
    at Socket.readFromStdout (/home/myuser/open-next-project/node_modules/esbuild/lib/main.js:679:7)
    at Socket.emit (node:events:517:28)
    at addChunk (node:internal/streams/readable:335:12) {
  errors: [Getter/Setter],
  warnings: [Getter/Setter]
}

Node.js v18.18.2

Package.json is as follows,

{
  "name": "open-next-project",
  "version": "1.5.12",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "package": "open-next build",
    "start": "next start",
    "analyze": "ANALYZE=true yarn build",
    "test": "jest --watch",
    "test:ci": "jest --ci",
    "type-check": "tsc --noEmit",
    "lint:eslint": "next lint --max-warnings=0",
    "lint:prettier": "prettier --ignore-unknown -w --check src/",
    "deploy": "serverless",
    "deploy-storybook-to": "aws s3 sync storybook-static/",
    "storybook": "start-storybook -p 6006 -s ./public",
    "build-storybook": "build-storybook -s ./public",
    "bump": "node bump.mjs"
  },
  "dependencies": {
    "@apollo/client": "^3.5.10",
    "@auth0/auth0-spa-js": "^2.1.2",
    "@babel/runtime": "^7.18.3",
    "@metamask/onboarding": "^1.0.1",
    "@picmo/popup-picker": "^5.7.2",
    "@segment/snippet": "^4.15.3",
    "@sentry/nextjs": "^7.56.0",
    "@stripe/stripe-js": "^1.35.0",
    "@types/lodash-es": "^4.17.6",
    "@walletconnect/client": "^1.7.7",
    "@walletconnect/qrcode-modal": "^1.7.7",
    "@walletconnect/web3-provider": "^1.7.7",
    "a11y-react-emoji": "^1.2.0",
    "alchemy-sdk": "^2.2.0",
    "axios": "^1.3.4",
    "axios-retry": "^3.4.0",
    "color": "^4.2.3",
    "d3": "3",
    "d3v7": "npm:d3@7",
    "date-fns": "^2.28.0",
    "dayjs": "^1.11.0",
    "dompurify": "^3.0.1",
    "formik": "^2.2.9",
    "graphql": "^16.3.0",
    "humps": "^2.0.1",
    "immutability-helper": "^3.1.1",
    "is-github-url": "^1.2.2",
    "lodash-es": "^4.17.21",
    "lottie-react": "^2.4.0",
    "mathjs": "^10.6.1",
    "next": "12.3.2",
    "notificationapi-js-client-sdk": "^4.3.1",
    "numeral": "^2.0.6",
    "open-next": "^2.3.1",
    "parse-github-url": "^1.0.2",
    "picmo": "^5.7.2",
    "react": "17.0.2",
    "react-color": "^2.19.3",
    "react-content-loader": "^6.2.0",
    "react-day-picker": "^8.0.5",
    "react-dnd": "^15.1.2",
    "react-dnd-html5-backend": "^16.0.1",
    "react-dnd-multi-backend": "^8.0.0",
    "react-dnd-touch-backend": "^16.0.1",
    "react-dom": "17.0.2",
    "react-flexbox-grid": "^2.1.2",
    "react-google-autocomplete": "^2.7.0",
    "react-icons": "^4.3.1",
    "react-infinite-scroll-hook": "^4.0.3",
    "react-scroll": "^1.8.6",
    "react-tippy": "^1.4.0",
    "react-toastify": "^9.0.5",
    "react-waypoint": "^10.1.0",
    "remark": "^14.0.2",
    "remark-emoji": "^3.0.2",
    "semantic-ui-css": "^2.4.1",
    "semantic-ui-react": "^2.1.2",
    "strip-markdown": "^5.0.0",
    "stripe": "^10.2.0",
    "styled-components": "^5.3.5",
    "swiper": "^9.1.1",
    "swr": "^2.1.3",
    "tinycolor2": "^1.4.2",
    "typesense": "^1.3.0",
    "ua-parser-js": "^1.0.35",
    "use-file-upload": "^1.0.11",
    "walletlink": "^2.5.0",
    "web3": "^1.8.1",
    "yup": "^0.32.11"
  },
  "devDependencies": {
    "@babel/core": "^7.17.9",
    "@next/bundle-analyzer": "^13.5.4",
    "@storybook/addon-actions": "^6.4.20",
    "@storybook/addon-essentials": "^6.4.20",
    "@storybook/addon-interactions": "^6.4.20",
    "@storybook/addon-links": "^6.4.20",
    "@storybook/builder-webpack5": "^6.4.20",
    "@storybook/manager-webpack5": "^6.4.20",
    "@storybook/react": "^6.4.20",
    "@svgr/webpack": "^6.2.1",
    "@types/auth0-js": "^9.14.6",
    "@types/dompurify": "^2.4.0",
    "@types/humps": "^2.0.2",
    "@types/is-github-url": "^1.2.0",
    "@types/jest": "^27.4.1",
    "@types/node": "17.0.23",
    "@types/numeral": "^2.0.2",
    "@types/parse-github-url": "^1.0.0",
    "@types/react": "17.0.43",
    "@types/segment-analytics": "^0.0.34",
    "@types/styled-components": "^5.1.24",
    "@types/ua-parser-js": "^0.7.36",
    "@typescript-eslint/eslint-plugin": "^5.27.0",
    "@typescript-eslint/parser": "^5.27.0",
    "babel-loader": "^8.2.4",
    "enzyme": "^3.11.0",
    "enzyme-adapter-react-16": "^1.15.6",
    "enzyme-to-json": "^3.6.2",
    "eslint": "8.11.0",
    "eslint-config-next": "12.1.0",
    "husky": "4",
    "inquirer": "^9.1.4",
    "jest": "^27.5.1",
    "jest-styled-components": "^7.0.8",
    "lint-staged": "^12.3.7",
    "prettier": "^2.6.1",
    "serverless": "2.72.3",
    "storybook-addon-next": "^1.6.2",
    "typescript": "4.6.3",
    "webpack": "^5.76.0"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged && yarn type-check && yarn lint:eslint && yarn test:ci"
    }
  },
  "lint-staged": {
    "**/*": "prettier --write --ignore-unknown",
    "*.{js,css,md,jsx,tsx,ts}": "prettier --write"
  },
  "packageManager": "[email protected]"
}

In MacOS using the exact same config and commands it works. I have reinstalled everything, npm, Node.js, node_modules the usual stuff to no avail.

Does anyone have any idea why this fails to build? Happy to provide more info wrt to the project, in case that's needed....

@ToanNguyen97
Copy link

Do guys have solution ? I got this issues too.

@conico974 conico974 added the wontfix This will not be worked on label Sep 28, 2024
@conico974
Copy link
Contributor

This is an issue with yarn pnp.
One easy fix would be to not use pnp
If you need it, you may want to take a look at this evanw/esbuild#2495 (comment) or experiment with some of the pnp options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants