環境:WIndows 11
Node.jsのバージョン:v16.14.2
不具合:Node.jsを最新に更新すると、yarn serverlessコマンドでAWSにデプロイ出来なくなった。(以前はデプロイ出来ていた)
> yarn serverless --stage=staging yarn run v1.22.17 $ H:\Next.js\serverless-nextjs-sample\node_modules\.bin\serverless --stage=staging error: Error: Command failed with exit code 1: node_modules/.bin/next build Browserslist: caniuse-lite is outdated. Please run: npx browserslist@latest --update-db (node:16932) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at H:\Next.js\serverless-nextjs-sample\node_modules\next\node_modules\postcss\package.json. Update this package.json to use a subpath pattern like "./*". (Use `node --trace-deprecation ...` to show where the warning was created) warn - Compiled with warnings ./node_modules/next/dist/next-server/server/load-components.js Critical dependency: the request of a dependency is an expression ./node_modules/next/dist/next-server/server/load-components.js Critical dependency: the request of a dependency is an expression ./node_modules/next/dist/next-server/server/require.js Critical dependency: the request of a dependency is an expression ./node_modules/next/dist/next-server/server/require.js Critical dependency: the request of a dependency is an expression ./node_modules/next/dist/next-server/server/require.js Critical dependency: the request of a dependency is an expression ./node_modules/next/node_modules/node-fetch/lib/index.js Module not found: Can't resolve 'encoding' in 'H:\Next.js\serverless-nextjs-sample\node_modules\next\node_modules\node-fetch\lib' ./node_modules/node-fetch/lib/index.js Module not found: Can't resolve 'encoding' in 'H:\Next.js\serverless-nextjs-sample\node_modules\node-fetch\lib' > Build error occurred Error: getStaticPaths can only be used with dynamic pages, not '/isr'. Learn more: https://nextjs.org/docs/routing/dynamic-routes at Object.isPageStatic (H:\Next.js\serverless-nextjs-sample\node_modules\next\dist\build\utils.js:23:58) at processTicksAndRejections (node:internal/process/task_queues:96:5) { type: 'Error' } info - Creating an optimized production build... info - Collecting page data... at makeError (C:\Users\kazum\.serverless\components\registry\npm\@sls-next\serverless-component@3.7.0-alpha.7\node_modules\execa\lib\error.js:60:11) at handlePromise (C:\Users\kazum\.serverless\components\registry\npm\@sls-next\serverless-component@3.7.0-alpha.7\node_modules\execa\index.js:118:26) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Builder.build (C:\Users\kazum\.serverless\components\registry\npm\@sls-next\serverless-component@3.7.0-alpha.7\node_modules\@sls-next\lambda-at-edge\dist\build.js:421:17) at async NextjsComponent.build (C:\Users\kazum\.serverless\components\registry\npm\@sls-next\serverless-component@3.7.0-alpha.7\node_modules\@sls-next\serverless-component\dist\component.js:170:13) at async NextjsComponent.default (C:\Users\kazum\.serverless\components\registry\npm\@sls-next\serverless-component@3.7.0-alpha.7\node_modules\@sls-next\serverless-component\dist\component.js:22:13) at async fn (H:\Next.js\serverless-nextjs-sample\node_modules\@serverless\template\utils.js:280:41) at async Promise.all (index 0) at async executeGraph (H:\Next.js\serverless-nextjs-sample\node_modules\@serverless\template\utils.js:294:3) at async Template.default (H:\Next.js\serverless-nextjs-sample\node_modules\@serverless\template\serverless.js:67:38) { shortMessage: 'Command failed with exit code 1: node_modules/.bin/next build', command: 'node_modules/.bin/next build', escapedCommand: '"node_modules/.bin/next" build', exitCode: 1, signal: undefined, signalDescription: undefined, stdout: 'info - Creating an optimized production build...\n' + 'info - Collecting page data...', stderr: 'Browserslist: caniuse-lite is outdated. Please run:\n' + 'npx browserslist@latest --update-db\n' + '(node:16932) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at H:\\Next.js\\serverless-nextjs-sample\\node_modules\\next\\node_modules\\postcss\\package.json.\n' + 'Update this package.json to use a subpath pattern like "./*".\n' + '(Use `node --trace-deprecation ...` to show where the warning was created)\n' + 'warn - Compiled with warnings\n' + '\n' + './node_modules/next/dist/next-server/server/load-components.js\n' + 'Critical dependency: the request of a dependency is an expression\n' + '\n' + './node_modules/next/dist/next-server/server/load-components.js\n' + 'Critical dependency: the request of a dependency is an expression\n' + '\n' + './node_modules/next/dist/next-server/server/require.js\n' + 'Critical dependency: the request of a dependency is an expression\n' + '\n' + './node_modules/next/dist/next-server/server/require.js\n' + 'Critical dependency: the request of a dependency is an expression\n' + '\n' + './node_modules/next/dist/next-server/server/require.js\n' + 'Critical dependency: the request of a dependency is an expression\n' + '\n' + './node_modules/next/node_modules/node-fetch/lib/index.js\n' + "Module not found: Can't resolve 'encoding' in 'H:\\Next.js\\serverless-nextjs-sample\\node_modules\\next\\node_modules\\node-fetch\\lib'\n" + '\n' + './node_modules/node-fetch/lib/index.js\n' + "Module not found: Can't resolve 'encoding' in 'H:\\Next.js\\serverless-nextjs-sample\\node_modules\\node-fetch\\lib'\n" + '\n' + '\n' + '> Build error occurred\n' + "Error: getStaticPaths can only be used with dynamic pages, not '/isr'.\n" + 'Learn more: https://nextjs.org/docs/routing/dynamic-routes\n' + ' at Object.isPageStatic (H:\\Next.js\\serverless-nextjs-sample\\node_modules\\next\\dist\\build\\utils.js:23:58)\n' + ' at processTicksAndRejections (node:internal/process/task_queues:96:5) {\n' + " type: 'Error'\n" + '}', failed: true, timedOut: false, isCanceled: false, killed: false } Done in 12.25s.
Please run:
npx browserslist@latest --update-db
とありますので、これを実行すると
> npx browserslist@latest --update-db Current version: 1.0.30001319 New version: 1.0.30001319 Removing old caniuse-lite from lock file Installing new caniuse-lite version $ npm install caniuse-lite Cleaning package.json dependencies from caniuse-lite $ npm uninstall caniuse-lite caniuse-lite has been successfully updated
全くversionに変化がありません。
もう一度
> yarn serverless --stage=staging
を実行しても最初と同じエラーが出て
Please run:
npx browserslist@latest --update-db
と書かれています。
直し方ご存じの方、いらっしゃいましたら手順を教えていただけますか?
よろしくお願いいたします。
あなたの回答
tips
プレビュー