-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Dependencies missing in standalone build #50072
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
Comments
What is not a feasible workaround: individually unplugging the missing dependencies and copying them into the standalone directory. Such as: # After running `yarn next build` as declared above, copy in the source of `styled-jsx`
# Add styled-jsx to the project (otherwise yarn will not unplug it)
yarn add styled-jsx
# Create unzipped copy of source of the dependency
yarn unplug styled-jsx
# Copy the dependency into the standalone application
cp -r .yarn/unplugged/styled-jsx*/node_modules .next/standalone Repeat for: The server will run, but opening the page with the browser looks like this:
|
I have the same issue event tho I'm not using
My build should be using swc also as I don't have any Here is my {
"name": "offline",
"version": "0.0.0",
"scripts": {
"nx": "nx",
"serve": "nx run-many --target=serve --all",
"start": "npm-run-all --parallel serve docker:services",
"lint": "nx workspace-lint && nx lint",
"format": "nx format:write",
"format:write": "nx format:write",
"format:check": "nx format:check",
"all:test": "pnpm docker:test && nx run-many --target=test --all",
"all:e2e": "nx run-many --target=e2e --all",
"update": "nx migrate latest && pnpm install && nx migrate --run-migrations",
"dep-graph": "nx dep-graph",
"nx-graph-static": "nx graph --file=static/nx-graph/index.html",
"help": "nx help",
"graphql-codegen": "nx run web:gql",
"thegraph-build": "graphclient build --dir libs/client/gql/thegraph/src",
"thegraph": "graphclient",
"affected:build": "nx affected:build",
"affected:e2e": "pnpm docker:services && nx affected:e2e",
"affected:test": "pnpm docker:test && nx affected:test && pnpm affected:test-prisma && pnpm affected:test-hasura",
"affected:test-prisma": "nx affected --target=test-prisma",
"affected:test-hasura": "nx affected --target=test-hasura",
"affected:lint": "nx affected:lint",
"affected:dep-graph": "nx affected:dep-graph",
"docker:services": "docker-compose --env-file .env.local up -d prisma-db && pnpm prisma:dev:deploy && docker-compose --env-file .env.local up -d",
"docker:test": "docker-compose -f tools/test/docker-compose.yml --env-file tools/test/.env.test.jest up -d prisma-test-db && pnpm prisma:test:deploy && docker-compose -f tools/test/docker-compose.yml --env-file tools/test/.env.test.jest up -d",
"docker:build": "docker-compose --env-file .env.local build",
"docker:stop": "docker-compose --env-file .env.local stop",
"docker:hasura-engine-logs": "docker-compose -f docker-compose.yaml --env-file .env.local logs -f hasura-engine",
"docker:hasura-console-logs": "docker-compose -f docker-compose.yaml --env-file .env.local logs -f hasura-console",
"docker:hasura-test-logs": "docker-compose -f tools/test/docker-compose.yml --env-file tools/test/.env.test.jest logs -f hasura-engine-test",
"prepare": "node -e \"try { require('husky').install() } catch (e) {if (e.code !== 'MODULE_NOT_FOUND') throw e}\"",
"cypress": "cypress",
"analyze:web": "cross-env ANALYZE=true nx build web",
"build-storybook:ui": "nx run ui-components:build-storybook",
"build-storybook:web": "nx run web:build-storybook",
"prisma:dev:deploy": "dotenv -e .env.local -- prisma migrate dev",
"prisma-db:dev:rm": "docker-compose --env-file .env.local rm prisma-db -s -f -v",
"prisma-db:dev:up": "docker-compose --env-file .env.local up prisma-db -d",
"prisma-db:dev:start": "pnpm prisma-db:dev:up && sleep 1 && pnpm prisma:dev:deploy",
"prisma-db:dev:restart": "pnpm prisma-db:dev:rm && pnpm prisma-db:dev:start",
"prisma:test:deploy": "dotenv -e tools/test/.env.test.jest -- prisma migrate dev",
"prisma-db:test:rm": "docker-compose -f tools/test/docker-compose.yml --env-file tools/test/.env.test.jest rm prisma_test_db -s -f -v",
"prisma-db:test:up": "docker-compose -f tools/test/docker-compose.yml --env-file tools/test/.env.test.jest up prisma_test_db -d",
"prisma-db:test:restart": "pnpm prisma-db:test:rm && pnpm prisma-db:test:up && sleep 1 && pnpm prisma:test:deploy",
"nest:dev:start": "nx run nestjs-server:serve",
"nest:e2e": "start-server-and-test e2e:server 'http://localhost:3333/api' e2e:test",
"e2e:test": "nx run nestjs-server-e2e:e2e",
"e2e:server": "nx run nestjs-server:serve --skip-nx-cache",
"vercel-build": "npm i -g node-gyp"
},
"private": true,
"dependencies": {
"@ethersproject/providers": "^5.7.2",
"@formkit/auto-animate": "1.0.0-beta.6",
"@nestjs/axios": "^0.1.1",
"@nestjs/common": "^9.4.3",
"@nestjs/config": "^2.3.3",
"@nestjs/core": "^9.4.3",
"@nestjs/jwt": "^9.0.0",
"@nestjs/microservices": "^9.4.3",
"@nestjs/platform-express": "^9.4.3",
"@nestjs/schedule": "^2.2.3",
"@nestjs/terminus": "^9.2.2",
"@next/font": "^13.4.5",
"@ntegral/nestjs-sentry": "^4.0.0",
"@prisma/client": "^4.15.0",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-alert-dialog": "^1.0.4",
"@radix-ui/react-aspect-ratio": "^1.0.3",
"@radix-ui/react-avatar": "^1.0.3",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.4",
"@radix-ui/react-dropdown-menu": "^2.0.5",
"@radix-ui/react-hover-card": "^1.0.6",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-navigation-menu": "^1.1.3",
"@radix-ui/react-popover": "^1.0.6",
"@radix-ui/react-progress": "^1.0.3",
"@radix-ui/react-select": "^1.2.2",
"@radix-ui/react-separator": "^1.0.3",
"@radix-ui/react-switch": "^1.0.3",
"@radix-ui/react-toast": "^1.1.4",
"@radix-ui/react-tooltip": "^1.0.6",
"@safe-global/api-kit": "^1.1.0",
"@safe-global/protocol-kit": "^1.0.1",
"@safe-global/safe-react-components": "^2.0.5",
"@sentry/nextjs": "^7.54.0",
"@sentry/node": "^7.54.0",
"@sentry/tracing": "^7.54.0",
"@tailwindcss/forms": "^0.5.3",
"@tailwindcss/typography": "^0.5.9",
"@tanstack/query-core": "^4.29.11",
"@tanstack/react-query": "^4.29.12",
"@types/cache-manager": "^4.0.2",
"@types/cache-manager-redis-store": "^2.0.1",
"@vercel/analytics": "^0.1.11",
"@web3auth/ui": "^5.2.0",
"@xstate/react": "^3.2.2",
"alchemy-sdk": "^2.9.0",
"autoprefixer": "^10.4.14",
"cache-manager": "^5.2.2",
"cache-manager-redis-store": "^3.0.1",
"chalk": "4.1.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"class-variance-authority": "^0.6.0",
"clsx": "^1.2.1",
"cmdk": "^0.2.0",
"coingecko-api-v3": "0.0.13",
"core-js": "^3.31.0",
"crypto-js": "^4.1.1",
"css-loader": "^6.8.1",
"date-fns": "^2.30.0",
"dotenv": "^16.1.4",
"ethers": "^5.7.2",
"express": "^4.18.2",
"framer-motion": "^6.5.1",
"graphql-ws": "^5.13.1",
"http-status-codes": "^2.2.0",
"immer": "^10.0.2",
"install": "^0.13.0",
"ioredis": "^5.3.2",
"joi": "^17.9.2",
"loglevel": "^1.8.1",
"loglevel-plugin-prefix": "^0.8.4",
"lucide-react": "^0.125.0",
"next": "13.4.5",
"next-auth": "4.22.1",
"next-intl": "2.15.0-beta.5",
"next-seo": "^5.15.0",
"next-sitemap": "^3.1.55",
"next-themes": "^0.2.1",
"node-cache-manager": "^1.2.0",
"node-fetch": "^2.6.11",
"nodemailer": "^6.9.3",
"openid-client": "^5.4.2",
"postcss": "^8.4.24",
"postcss-import": "^15.1.0",
"postcss-loader": "^7.3.3",
"prisma": "^4.15.0",
"react": "^18.2.0",
"react-day-picker": "^8.7.1",
"react-dom": "^18.2.0",
"react-hook-form": "^7.44.3",
"react-hot-toast": "^2.4.1",
"react-icons": "^4.9.0",
"react-use": "^17.4.0",
"reflect-metadata": "^0.1.13",
"regenerator-runtime": "0.13.7",
"remeda": "^1.19.0",
"rxjs": "^7.8.1",
"siwe": "^2.1.4",
"tailwind-merge": "^1.13.1",
"tailwindcss": "^3.3.2",
"tailwindcss-animate": "^1.0.6",
"tslib": "^2.5.3",
"uuid": "^8.3.2",
"web3": "^1.10.0",
"websocket": "^1.0.34",
"zod": "^3.21.4",
"zustand": "^4.3.8"
},
"devDependencies": {
"@babel/core": "^7.22.5",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.22.5",
"@babel/preset-react": "^7.22.5",
"@babel/preset-typescript": "^7.22.5",
"@babel/runtime": "^7.22.5",
"@cypress/code-coverage": "^3.10.7",
"@depay/web3-mock-evm": "^14.11.1",
"@faker-js/faker": "^7.6.0",
"@graphprotocol/client-cli": "^2.2.22",
"@graphql-codegen/add": "^3.2.3",
"@graphql-codegen/cli": "^2.16.5",
"@graphql-codegen/client-preset": "^1.3.0",
"@graphql-codegen/hasura-allow-list": "^2.0.0",
"@graphql-codegen/introspection": "^2.2.3",
"@graphql-codegen/schema-ast": "^2.6.1",
"@graphql-codegen/typescript": "^2.8.8",
"@graphql-codegen/typescript-generic-sdk": "^3.1.0",
"@graphql-codegen/typescript-operations": "^2.5.13",
"@graphql-codegen/typescript-react-query": "^4.1.0",
"@graphql-eslint/eslint-plugin": "^3.19.1",
"@nestjs/schematics": "^9.2.0",
"@nestjs/testing": "^9.4.3",
"@next/bundle-analyzer": "^13.4.5",
"@nx/cypress": "16.3.2",
"@nx/devkit": "16.3.2",
"@nx/eslint-plugin": "16.3.2",
"@nx/eslint-plugin-nx": "16.0.0-beta.1",
"@nx/jest": "16.3.2",
"@nx/js": "16.3.2",
"@nx/linter": "16.3.2",
"@nx/nest": "16.3.2",
"@nx/next": "16.3.2",
"@nx/node": "16.3.2",
"@nx/plugin": "16.3.2",
"@nx/react": "16.3.2",
"@nx/rollup": "16.3.2",
"@nx/storybook": "16.3.2",
"@nx/web": "16.3.2",
"@nx/webpack": "16.3.2",
"@nx/workspace": "16.3.2",
"@rollup/plugin-url": "^7.0.0",
"@safe-global/auth-kit": "^1.0.0",
"@storybook/addon-a11y": "7.0.17",
"@storybook/addon-essentials": "7.0.17",
"@storybook/addon-interactions": "7.0.17",
"@storybook/addon-mdx-gfm": "7.0.17",
"@storybook/addon-styling": "1.0.8",
"@storybook/builder-webpack5": "7.0.17",
"@storybook/core-common": "7.0.17",
"@storybook/core-server": "7.0.17",
"@storybook/jest": "0.1.0",
"@storybook/nextjs": "7.0.17",
"@storybook/react": "7.0.17",
"@storybook/react-webpack5": "7.0.17",
"@storybook/test-runner": "0.10.0",
"@storybook/testing-library": "0.1.0",
"@storybook/theming": "7.0.17",
"@svgr/rollup": "^6.5.1",
"@svgr/webpack": "^6.5.1",
"@swc-node/register": "^1.6.5",
"@swc/cli": "~0.1.62",
"@swc/core": "^1.3.62",
"@swc/jest": "0.2.20",
"@tanstack/react-query-devtools": "^4.29.12",
"@testing-library/cypress": "^9.0.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "14.0.0",
"@testing-library/user-event": "^14.4.3",
"@types/cron": "^2.0.1",
"@types/jest": "29.5.0",
"@types/jsonwebtoken": "^9.0.2",
"@types/node": "18.14.2",
"@types/node-fetch": "^2.6.4",
"@types/pg": "^8.10.2",
"@types/react": "^18.2.11",
"@types/react-dom": "^18.2.4",
"@types/testing-library__jest-dom": "^5.14.6",
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"@web3auth/base": "^5.2.0",
"@web3auth/modal": "^5.2.1",
"@web3auth/openlogin-adapter": "^5.2.1",
"axe-playwright": "^1.2.3",
"babel-jest": "^29.5.0",
"babel-loader": "^9.1.2",
"chromatic": "^6.18.2",
"cross-env": "^7.0.3",
"cypress": "^12.14.0",
"dotenv-cli": "^6.0.0",
"encoding": "^0.1.13",
"eslint": "~8.15.0",
"eslint-config-next": "13.4.5",
"eslint-config-prettier": "8.1.0",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-cypress": "^2.13.3",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-json": "^3.1.0",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-markdown": "^3.0.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "7.32.2",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-sonarjs": "^0.16.0",
"eslint-plugin-storybook": "^0.6.12",
"eslint-plugin-tailwindcss": "^3.12.1",
"eth-testing": "^1.14.0",
"flowbite-typography": "^1.0.3",
"graphql": "^16.6.0",
"graphql-config": "^4.5.0",
"husky": "^8.0.3",
"is-ci": "^3.0.1",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jsonc-eslint-parser": "^2.3.0",
"jsonwebtoken": "^9.0.0",
"lint-staged": "^13.2.2",
"msw": "^1.2.2",
"next-router-mock": "^0.9.6",
"npm-run-all": "^4.1.5",
"nx": "16.3.2",
"nx-cloud": "16.0.5",
"pactum": "^3.4.1",
"pg": "^8.11.0",
"prettier": "^2.8.8",
"prettier-plugin-prisma": "^4.13.0",
"react-refresh": "^0.10.0",
"react-test-renderer": "18.2.0",
"start-server-and-test": "^1.15.4",
"storybook-addon-swc": "^1.2.0",
"storybook-dark-mode": "^3.0.0",
"swc-loader": "0.1.15",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"tsconfig-paths-webpack-plugin": "^4.0.1",
"typescript": "~5.1.3",
"url-loader": "^4.1.1"
},
"packageManager": "[email protected]",
"engines": {
"node": ">=16.0.0",
"pnpm": ">=7"
},
"_id": "[email protected]",
"msw": {
"workerDirectory": "apps/nestjs-server/src"
}
}
My /* eslint-disable @typescript-eslint/no-var-requires */
const { withNx } = require('@nx/next');
const path = require('path');
const { withSentryConfig } = require('@sentry/nextjs');
/**
* Don't be scared of the generics here.
* All they do is to give us autocompletion when using this.
*
* @template {import('next').NextConfig} T
* @param {T} nextI18n - A generic parameter that flows through to the return type
* @constraint {{import('next').NextConfig}}
*/
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
const withNextIntl = require('next-intl/plugin')();
const SENTRY_DSN = process.env.SENTRY_AUTH_TOKEN
? null
: process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
compiler: {
removeConsole: process.env.NODE_ENV === 'production',
},
/* could improve performance in dev but @ui components no organized like that.
See that as ref: https://github.com/knitkode/koine/blob/3046607d655a3cfa1e3b3438f1aef168fbdc6ad5/packages/next/config/index.ts#L251
https://nextjs.org/blog/next-13-1#import-resolution-for-smaller-bundles
And this thread n
+ this article: https://medium.com/@yashashr/next-js-optimization-for-better-performance-part-1-material-ui-mui-configs-plugins-6fdc48a4e984
*/
// modularizeImports: {
// '@ui/components/?(((\\w*)?/?)*)': {
// transform: '@ui/components/{{ matches.[1] }}/{{member}}',
// },
// },
transpilePackages: ['@ui/components', '@ui/theme', '@ui/icons', 'styled-jsx'],
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'picsum.photos',
port: '',
pathname: '/seed/hero/**',
},
],
},
// optimize build with vercel nft (node file tracing) https://nextjs.org/docs/advanced-features/output-file-tracing
// outputFileTracingRoot needed for monorepo
output: 'standalone',
experimental: {
outputFileTracingRoot: path.join(__dirname, '../../'),
outputFileTracingExcludes: {
'*': [
'./**/@swc/core-linux-x64-gnu*',
'./**/@swc/core-linux-x64-musl*',
'./**/@esbuild*',
'./**/webpack*',
'./**/rollup*',
'./**/terser*',
'./**/sharp*',
],
},
serverActions: true,
appDir: true,
typedRoutes: false, // no solution found to get it working with nx monorepo (not accessible from external libs like feature)
},
};
const sentryWebpackPluginOptions = {
// Additional config options for the Sentry Webpack plugin. Keep in mind that
// the following options are set automatically, and overriding them is not
// recommended:
// release, url, org, project, authToken, configFile, stripPrefix,
// urlPrefix, include, ignore
dryRun: !SENTRY_DSN,
hideSourceMaps: true,
silent: true, // Suppresses all logs
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options.
};
module.exports = async (phase, context) => {
const addNx = withNx({
...nextConfig,
});
let config = await addNx(phase);
// // TODO, set back after fix for: Module not found: Can't resolve '@sentry/utils/esm/buildPolyfills'
// config = await withSentryConfig(config, sentryWebpackPluginOptions);
config = await withBundleAnalyzer(config);
config = await withNextIntl(config);
return config;
}; My {
"name": "web",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/web",
"projectType": "application",
"targets": {
"build": {
"executor": "@nx/next:build",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"root": "apps/web",
"outputPath": "apps/web/dist",
"postcssConfig": "apps/web/postcss.config.js"
},
"assets": [
{
"input": "libs/ui/shared/src/assets",
"glob": "**/*",
"output": "assets"
}
],
"configurations": {
"development": {
"outputPath": "apps/web"
},
"production": {}
}
},
"serve": {
"executor": "@nx/next:server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "web:build",
"hmr": true,
"port": 8888,
"dev": true,
"assets": [
{
"input": "libs/ui/shared/src/assets",
"glob": "**/*",
"output": "assets"
}
]
},
"configurations": {
"development": {
"buildTarget": "web:build:development",
"dev": true
},
"production": {
"buildTarget": "web:build:production",
"dev": false
}
}
},
"is-services-launched": {
"executor": "nx:run-commands",
"options": {
"commands": ["node tools/test/isServicesLaunched.js"],
"readyWhen": "Services ready"
}
},
"serve-e2e": {
"executor": "nx:run-commands",
"options": {
"commands": ["nx is-services-launched web", "nx serve web"],
"readyWhen": "Services ready"
}
},
"export": {
"executor": "@nx/next:export",
"options": {
"buildTarget": "web:build:production"
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/apps/web"],
"options": {
"jestConfig": "apps/web/jest.config.ts",
"passWithNoTests": true
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/web/**/*.{ts,tsx,js,jsx,gql,graphql}"]
}
},
"gql": {
"executor": "nx:run-commands",
"options": {
"commands": [
{
"command": "npx graphql-codegen --config codegen.yml -r dotenv/config -e .env.local "
}
]
}
},
"storybook": {
"executor": "@nx/storybook:storybook",
"options": {
"port": 4401,
"quiet": true,
"configDir": "apps/web/.storybook"
},
"configurations": {
"ci": {
"quiet": true
}
}
},
"build-storybook": {
"executor": "@nx/storybook:build",
"outputs": ["{options.outputDir}"],
"options": {
"configDir": "apps/web/.storybook",
"outputDir": "dist/storybook/web",
"webpackStatsJson": true
},
"configurations": {
"ci": {
"quiet": true
}
}
},
"test-storybook": {
"executor": "nx:run-commands",
"options": {
"command": "test-storybook -c apps/web/.storybook --url=http://localhost:4401"
}
}
},
"tags": []
} And my settings on vercel: ![]() Any help would be greatly appreciated ! |
Hello, I have a similar issue with the latest version of nextjs v13.4.5: The lib is not included in .next/standalone/node-modules when builded with : |
I have a similar issue in standalone mode :
The file is present in my local |
I hit the same thing following the "with-docker" example as described in https://nextjs.org/docs/pages/building-your-application/deploying#docker-image. I was able to solve it by also including the |
(next 13.5.1) I build with
The procedures I followed:
pnpm next build
cp -r public build/standalone/* Dockerfile docker The simple Dockerfile (just copy assets in docker folder and start server.js):
I took a look at the error file
It might be related to pnpm module path. I don't know. |
I have a similar issue, both with pnpm and yarn. Haven't tried with npm.
Trying to run a standalone build with [email protected]. Any news? |
pnpm uses sym linking when creating the modules so you might run into issues like this of missing modules. Either follow this https://pnpm.io/docker or use I assume yarn has a similar thing |
I am having the same issue while trying to use @newrelic/next dependency. |
Seems this issue still exists. It's To give more info, it's not that it doesn't exist, it's that some of it is missing: Local:
In container built with the typical Dockerfile:
|
Yeah, this issue still exists. We're getting it as well on 13.5.2. |
I think the devs have enough information by now. Can everyone think twice before bumping, so that we don't end up with an ocean of "this happens to me on ..." replies? Thanks. |
Are they doing anything about it? Seems like this has been a thing for more than a year. |
@0xbid Just as a reminder, Next.js is a commercial project by Vercel, which is a company that offers web hosting. I don't think this is at the top of their priorities since it would make self-hosting much easier, reducing their profit. :-/ |
I tried to reproduce the issue, but it doesn't build:
I copied the
And to be frank, it doesn't look like MRE. I myself ran into another issue. Which looks like yours a bit, but likely isn't. |
|
I don't think this take is quite fair as this issue seems to also affect instrumentation of tracing. If people can't easily implement tracing—or that is the perception—with third party libraries, that will hinder adoption of their web-hosting platform too. |
Having the same problem with fresh clone of vercel's create next js app template on local machine.
Error Required package: styled-jsx (via "styled-jsx/package.json") |
I found a solution here: You need to run the following command to copy files that are not automatically being copied.
|
This is the solution when attempting to use the standalone directory for AWS Lambda deployments. Nice find! |
Hi everyone, Managing environment variables can sometimes be tricky, especially during builds. To help with this, we created the "stop-nagging" tool. It can streamline managing environment variables and reduce noise, which might be useful in cases like this. Feel free to check it out! |
Uh oh!
There was an error while loading. Please reload this page.
Verify canary release
Provide environment information
Operating System: Platform: linux Arch: x64 Version: #1 SMP PREEMPT_DYNAMIC Debian 6.1.27-1 (2023-05-08) Binaries: Node: 18.13.0 npm: 6.14.18 Yarn: 3.5.1 pnpm: N/A Relevant packages: next: 13.4.3 eslint-config-next: 13.4.3 react: 18.2.0 react-dom: 18.2.0 typescript: 5.0.4
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue or a replay of the bug
https://github.com/Adelrisk/reproducer_nextjs_standalone_require
To Reproduce
Prepare a project
Prepare without the reproducer
Prepare with the reproducer
Reproduce the problem
Without docker:
With docker:
Add the following file to the directory:
docker build --file Dockerfile -t temp_next_broken . docker run -it --rm=true --name nextjs_test -p 3000:3000 temp_next_broken
Describe the Bug
One-time error with latest (not canary)
When I started to document the steps to reproduce the error, it was identical to #48173
However, after using canary, I couldn't reproduce the error, even after downgrading.
Error with canary/latest version
The error with docker
The error without docker
Expected Behavior
I would expect the MVP app to run without problems.
Additionally, I notice that the script
node_modules/next/dist/server/require-hook.js
attempts to require many other (not available) third party dependencies:Once I faked all these dependencies, additional require calls fail because these dependencies are missing:
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
node server.js
The text was updated successfully, but these errors were encountered: