質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Next.js

Next.jsは、Reactを用いたサーバサイドレンダリングなどを行う軽量なフレームワークです。Zeit社が開発しており、nextコマンドでプロジェクトを作成することにより、開発環境整備が整った環境が即時に作成できます。

AWS Amplify

AWS Amplifyとは、AWSを用いたWebアプリケーション向けのJavaScriptライブラリです。サインアップ/サインイン、MFA、コンテンツ管理、さらにサーバーレスなバックエンドの自動構築などの実装が容易にできます。

Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

Q&A

0回答

1284閲覧

serverless-nextjsのデプロイ時にPlease run: npx browserslist@latest --update-dbの実行を求められるが実行しても直らない

kazumaro1980

総合スコア14

Next.js

Next.jsは、Reactを用いたサーバサイドレンダリングなどを行う軽量なフレームワークです。Zeit社が開発しており、nextコマンドでプロジェクトを作成することにより、開発環境整備が整った環境が即時に作成できます。

AWS Amplify

AWS Amplifyとは、AWSを用いたWebアプリケーション向けのJavaScriptライブラリです。サインアップ/サインイン、MFA、コンテンツ管理、さらにサーバーレスなバックエンドの自動構築などの実装が容易にできます。

Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

0グッド

0クリップ

投稿2022/03/23 10:06

環境: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

と書かれています。

直し方ご存じの方、いらっしゃいましたら手順を教えていただけますか?
よろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問