使用无服务器框架将 NextJS 应用程序部署到 AWS 时出错

时间:2021-04-10 08:49:37

标签: javascript amazon-web-services next.js serverless-framework aws-serverless

当我尝试使用无服务器框架将我的 NextJS 应用程序部署到 AWS 时。

在我的下一个 JS 应用程序目录中,我运行了命令 npx serverless

并得到以下错误 -

$ npx serverless

  error:
  Error: Command failed with ENOENT: node_modules/.bin/next build
spawn node_modules/.bin/next ENOENT
'node_modules\.bin\next' is not recognized as an internal or external command,
operable program or batch file.
    at notFoundError (C:\Users\patel\.serverless\components\registry\npm\@sls-next\serverless-component@1.18.0\node_modules\@sls-next\serverless-component\node_modules\cross-spawn\lib\enoent.js:6:26)
    at verifyENOENT (C:\Users\patel\.serverless\components\registry\npm\@sls-next\serverless-component@1.18.0\node_modules\@sls-next\serverless-component\node_modules\cross-spawn\lib\enoent.js:40:16)
    at ChildProcess.cp.emit (C:\Users\patel\.serverless\components\registry\npm\@sls-next\serverless-component@1.18.0\node_modules\@sls-next\serverless-component\node_modules\cross-spawn\lib\enoent.js:27:25)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) {
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn node_modules/.bin/next',
  path: 'node_modules/.bin/next',
  spawnargs: [ 'build' ],
  originalMessage: 'spawn node_modules/.bin/next ENOENT',
  shortMessage: 'Command failed with ENOENT: node_modules/.bin/next build\n' +
    'spawn node_modules/.bin/next ENOENT',
  command: 'node_modules/.bin/next build',
  exitCode: undefined,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: "'node_modules\\.bin\\next' is not recognized as an internal or external command,\r\n" +
    'operable program or batch file.',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}

  3s » myNextApplication » Error: Command failed with ENOENT: node_modules/.bin/next build
spawn node_modules/.bin/next ENOENT
'node_modules\.bin\next' is not recognized as an internal or external command,
operable program or batch file.

我正在使用 aws configure 设置我的 AWS 凭证。

我的 serverless.yml 文件如下,

myNextApplication:
  component: "@sls-next/serverless-component@1.18.0"

我应该如何使用无服务器框架将我的应用程序部署到 AWS 云?

谢谢。

0 个答案:

没有答案