Yovach
Yovach14mo ago

Standalone Next.js 13.3.2 error

Hi, since the 13.3.2 update of Next.js, I have the following error :
TypeError: Cannot read properties of null (reading 'useState')
at exports.useState (/home/quentin/labs/monorepo/apps/website/.next/standalone/node_modules/next/dist/compiled/react/cjs/react.production.min.js:29:394)
at WithTRPC (/home/quentin/labs/monorepo/apps/website/.next/standalone/apps/website/.next/server/chunks/1435.js:49:83)
at renderWithHooks (/home/quentin/labs/monorepo/apps/website/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5658:16)
at renderIndeterminateComponent (/home/quentin/labs/monorepo/apps/website/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5731:15)
at renderElement (/home/quentin/labs/monorepo/apps/website/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5946:7)
at renderNodeDestructiveImpl (/home/quentin/labs/monorepo/apps/website/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6104:11)
at renderNodeDestructive (/home/quentin/labs/monorepo/apps/website/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6076:14)
at renderIndeterminateComponent (/home/quentin/labs/monorepo/apps/website/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5785:7)
at renderElement (/home/quentin/labs/monorepo/apps/website/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5946:7)
at renderNodeDestructiveImpl (/home/quentin/labs/monorepo/apps/website/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6104:11)
TypeError: Cannot read properties of null (reading 'useState')
at exports.useState (/home/quentin/labs/monorepo/apps/website/.next/standalone/node_modules/next/dist/compiled/react/cjs/react.production.min.js:29:394)
at WithTRPC (/home/quentin/labs/monorepo/apps/website/.next/standalone/apps/website/.next/server/chunks/1435.js:49:83)
at renderWithHooks (/home/quentin/labs/monorepo/apps/website/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5658:16)
at renderIndeterminateComponent (/home/quentin/labs/monorepo/apps/website/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5731:15)
at renderElement (/home/quentin/labs/monorepo/apps/website/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5946:7)
at renderNodeDestructiveImpl (/home/quentin/labs/monorepo/apps/website/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6104:11)
at renderNodeDestructive (/home/quentin/labs/monorepo/apps/website/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6076:14)
at renderIndeterminateComponent (/home/quentin/labs/monorepo/apps/website/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5785:7)
at renderElement (/home/quentin/labs/monorepo/apps/website/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5946:7)
at renderNodeDestructiveImpl (/home/quentin/labs/monorepo/apps/website/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6104:11)
2 Replies
Yovach
Yovach14mo ago
I'm using Docker so I need to have the following next.config.js :
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
reactStrictMode: true,
trailingSlash: true,
poweredByHeader: false,
swcMinify: true,
productionBrowserSourceMaps: false,
experimental: {
appDir: true,
esmExternals: true,
legacyBrowsers: false,
enableUndici: true,
outputFileTracingRoot: path.join(__dirname, '../../'),
},
output: "standalone",
};

export default nextConfig;
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
reactStrictMode: true,
trailingSlash: true,
poweredByHeader: false,
swcMinify: true,
productionBrowserSourceMaps: false,
experimental: {
appDir: true,
esmExternals: true,
legacyBrowsers: false,
enableUndici: true,
outputFileTracingRoot: path.join(__dirname, '../../'),
},
output: "standalone",
};

export default nextConfig;
I'm doing the following steps: npm run build and node .next/standalone/apps/website/server.js NOTE: With Next.js 13.3.1, it's working EDIT: In Next.js 13.3.2, it seems to work without output: "standalone" I disabled appDir and it's working again, I'll report to Vercel.
Yovach
Yovach14mo ago
GitHub
Build software better, together
GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 330 million projects.