terraform-aws-next-js icon indicating copy to clipboard operation
terraform-aws-next-js copied to clipboard

Build error yarn tf-next

Open sumantapakira opened this issue 3 years ago • 6 comments

I am following these steps: https://github.com/milliHQ/terraform-aws-next-js/tree/main/examples/complete

  1. yarn create next-app --example https://github.com/milliHQ/terraform-aws-next-js/tree/main/examples/complete my-app
  2. cd my-app
  3. yarn tf-next or npm run tf-nex

After getting this error-

yarn run v1.22.15 $ tf-next build Checking out files... Installing dependencies... 'yarn' is not recognized as an internal or external command, operable program or batch file. Build failed: NowBuildError: Command "yarn install" exited with 1 at ChildProcess. (C:\Projects\my-app\node_modules@vercel\build-utils\dist\index.js:29311:20) at ChildProcess.emit (node:events:390:28) at ChildProcess.emit (node:domain:475:12) at ChildProcess.cp.emit (C:\Projects\my-app\node_modules@vercel\build-utils\dist\index.js:3216:29) at maybeClose (node:internal/child_process:1064:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) { hideStackTrace: true, code: 'BUILD_UTILS_SPAWN_1', link: undefined, action: undefined } error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Node version: 16.13.0

Of course yarn build command works fine.

What wrong am I doing?

sumantapakira avatar Jan 12 '22 14:01 sumantapakira

Hi, looks like yarn could not be resolved from the PATH environment variable. Main error message here seems to be

'yarn' is not recognized as an internal or external command,
operable program or batch file.

Have you installed yarn through npm or from the msi-installer? Need to check it on my Windows machine, in the meantime here is a discussion about why this problem might happens: https://github.com/yarnpkg/yarn/issues/2504

ofhouse avatar Jan 13 '22 09:01 ofhouse

Tried using both msi and npm global command but did not help. I am wondering why this particular command yarn tf-next is failing but all other command such as yarn --version works fine!

sumantapakira avatar Jan 13 '22 17:01 sumantapakira

Strange, encountered the same issue on my Windows machine. However I was able to finish the same build with npx: npx tf-next build.

ofhouse avatar Jan 13 '22 19:01 ofhouse

@ofhouse Facing the same issue when running tf-next build, updated all my packages and even reverted from pnpm to yarn and still no luck. Were you able to reproduce the following issue on MAC-OS by any chance?

Here's the stack trace: Couldn't find any versions for "config" that matches "workspace:*"

? Please choose a version of "config" from this list: 3.3.7
[3/5] 🚚  Fetching packages...
error @typescript-eslint/[email protected]: The engine "node" is incompatible with this module. Expected version "^12.22.0 || ^14.17.0 || >=16.0.0". Got "14.16.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Build failed:
NowBuildError: Command "yarn install" exited with 1
    at ChildProcess.emit (events.js:315:20)
    at ChildProcess.EventEmitter.emit (domain.js:467:12)
    at maybeClose (internal/child_process.js:1048:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) {
  hideStackTrace: true,
  code: 'BUILD_UTILS_SPAWN_1',
  link: undefined,
  action: undefined
}

wcisco17 avatar Jan 14 '22 21:01 wcisco17

@wcisco17 This seems so be an unrelated error because the command failed with another error message:

error @typescript-eslint/[email protected]: The engine "node" is incompatible with this module. Expected version "^12.22.0 || ^14.17.0 || >=16.0.0". Got "14.16.0"
error Found incompatible module.

You should able to fix the issue by upgrading the Node.js version installed on your machine. You can check the currently installed version by running node --version from your terminal. According to the error message it should be at least 14.17.0.

This is a requirement from the package @typescript-eslint/parser and is therefore unrelated to our tool.

ofhouse avatar Jan 15 '22 12:01 ofhouse

Hey thanks for the help will @ofhouse do 👍🏾

wcisco17 avatar Jan 15 '22 16:01 wcisco17