nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.63k stars 2.36k forks source link

Build failed in aws codebuild #10713

Closed semoonpark closed 2 years ago

semoonpark commented 2 years ago

Current Behavior

Hello, currently, my project's build is failed in aws codebuild. and the logs are below.

Cannot find module 'dotenv/config'
Require stack:
- /usr/src/app/node_modules/@nrwl/next/src/executors/build/build.impl.js
- /usr/src/app/node_modules/nx/src/config/workspaces.js
- /usr/src/app/node_modules/nx/src/command-line/run.js
- /usr/src/app/node_modules/nx/bin/run-executor.js

It was built correctly until last Wednesday. Really don't know the reason why.

nx version: 13.10.2

>  NX   Report complete - copy this into the issue template

   Node : 14.17.5
   OS   : darwin x64
   yarn : 1.22.11

   nx : 13.10.2
   @nrwl/angular : Not Found
   @nrwl/cypress : 13.10.2
   @nrwl/detox : Not Found
   @nrwl/devkit : 13.10.2
   @nrwl/eslint-plugin-nx : 13.10.2
   @nrwl/express : Not Found
   @nrwl/jest : 13.10.2
   @nrwl/js : 13.10.2
   @nrwl/linter : 13.10.2
   @nrwl/nest : Not Found
   @nrwl/next : 13.10.2
   @nrwl/node : Not Found
   @nrwl/nx-cloud : 14.0.5
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 13.10.2
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 13.10.2
   @nrwl/web : 13.10.2
   @nrwl/workspace : 13.10.2
   typescript : 4.5.3
   rxjs : 6.6.7
   ---------------------------------------
   Community plugins:

Expected Behavior

Steps to Reproduce

This issue may not be prioritized if details are not provided to help us reproduce the issue.

Failure Logs

Environment

jaysoo commented 2 years ago

This might be due to package dependency hoisting with yarn.

You could try installing dotenv package directly if the error comes up again. The next plugin is importing dotenv/config but does not have an explicit dependency on it. I'll fix this is a PR.

jaysoo commented 2 years ago

I think something like this will avoid potential problems in different environments.

https://github.com/nrwl/nx/pull/11167

jaysoo commented 2 years ago

Closing this issue as I believe the fix in https://github.com/nrwl/nx/pull/11167 solves this. Please re-open with a reproduction repo if it is still a problem.

warunaideabits commented 2 years ago

@jaysoo It got this in AWS code build : [Container] 2022/07/20 09:31:59 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: nx affected --target=test --base=$LAST_SUCCESSFUL_COMMIT_HASH --head=HEAD. Reason: exit status 1

I used these commands:

build: commands:

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.