Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'aws-cdk-lib' of undefined when running npm ci during build stage #790

Closed
chrisammon3000 opened this issue Nov 30, 2022 · 3 comments
Labels
bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/small Small work item – less than a day of effort p1 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@chrisammon3000
Copy link

chrisammon3000 commented Nov 30, 2022

Describe the bug

npm ci fails during pipeline build stage. Possibly after updating to version 2.53.0.

Expected Behavior

npm ci should run and build should complete successfully.

Current Behavior

[Container] 2022/11/30 01:59:31 Phase complete: INSTALL State: SUCCEEDED
--
31 | [Container] 2022/11/30 01:59:31 Phase context status code:  Message:
32 | [Container] 2022/11/30 01:59:32 Entering phase PRE_BUILD
33 | [Container] 2022/11/30 01:59:32 Phase complete: PRE_BUILD State: SUCCEEDED
34 | [Container] 2022/11/30 01:59:32 Phase context status code:  Message:
35 | [Container] 2022/11/30 01:59:32 Entering phase BUILD
36 | [Container] 2022/11/30 01:59:32 Running command npm ci
37 | npm ERR! Cannot read property 'aws-cdk-lib' of undefined
38 |  
39 | npm ERR! A complete log of this run can be found in:
40 | npm ERR!     /root/.npm/_logs/2022-11-30T01_59_32_601Z-debug.log
41 |  
42 | [Container] 2022/11/30 01:59:32 Command did not exit successfully npm ci exit status 1
43 | [Container] 2022/11/30 01:59:32 Phase complete: BUILD State: FAILED
44 | [Container] 2022/11/30 01:59:32 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: npm ci. Reason: exit status 1

Reproduction Steps

  1. Run npx cdk deploy after completing the step "Create New Pipeline" in the CDK Workshop for Typescript.
  2. Push changes to CodeCommit repository
  3. CodePipeline starts a build automatically

Possible Solution

  • Deleted package-lock.json
  • Deleted node_modules
  • Reinstall using npm install

Additional Information/Context

Before running into this issue I update cdk to 2.53.0

CDK CLI Version

2.53.0 (build 7690f43)

Section

TypeScript Workshop → Advanced Topics → CDK Pipelines → Create New Pipeline

Browser

Chrome

Language

Typescript

@chrisammon3000 chrisammon3000 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 30, 2022
@chrisammon3000 chrisammon3000 changed the title (short issue description) Cannot read property 'aws-cdk-lib' of undefined when running npm ci during build stage Nov 30, 2022
@gregbreen
Copy link

Hi. I got this same error when I used a much newer version of npm (9) on my dev machine than what was available in the CodeBuild image (6). I had to explicitly specify a newer build image in my CDK app.

        buildEnvironment: {
          buildImage: codebuild.LinuxBuildImage.STANDARD_6_0
        },

@peterwoodworth
Copy link
Contributor

Should be addressed on the latest version of CDK aws/aws-cdk#24544

Let us know if this needs to still be configured on latest version of CDK

@peterwoodworth peterwoodworth added p1 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Mar 15, 2023
@github-actions
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Mar 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/small Small work item – less than a day of effort p1 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

3 participants