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

cdk init failed with node 22.5.0 #30889

Closed
chenrui333 opened this issue Jul 18, 2024 · 5 comments
Closed

cdk init failed with node 22.5.0 #30889

chenrui333 opened this issue Jul 18, 2024 · 5 comments
Labels
bug This issue is a bug. effort/small Small work item – less than a day of effort p2 package/tools Related to AWS CDK Tools or CLI

Comments

@chenrui333
Copy link

Describe the bug

failed to run cdk init with nodejs 22.5.0 environment

==> /opt/homebrew/Cellar/aws-cdk/2.149.0/bin/cdk list
node:internal/modules/cjs/loader:1222
  throw err;
  ^

Error: Cannot find module 'constructs'
Require stack:
- /private/tmp/aws-cdk-test-20240718-31116-9aq66x/testapp/node_modules/aws-cdk-lib/core/lib/stack.js
- /private/tmp/aws-cdk-test-20240718-31116-9aq66x/testapp/node_modules/aws-cdk-lib/core/lib/index.js
- /private/tmp/aws-cdk-test-20240718-31116-9aq66x/testapp/node_modules/aws-cdk-lib/core/index.js
- /private/tmp/aws-cdk-test-20240718-31116-9aq66x/testapp/node_modules/aws-cdk-lib/index.js
- /private/tmp/aws-cdk-test-20240718-31116-9aq66x/testapp/bin/testapp.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1219:15)
    at Module._load (node:internal/modules/cjs/loader:1045:27)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:215:24)
    at Module.require (node:internal/modules/cjs/loader:1304:12)
    at require (node:internal/modules/helpers:123:16)
    at constructs_1 (/private/tmp/aws-cdk-test-20240718-31116-9aq66x/testapp/node_modules/aws-cdk-lib/core/lib/stack.js:1:464)
    at Object.<anonymous> (/private/tmp/aws-cdk-test-20240718-31116-9aq66x/testapp/node_modules/aws-cdk-lib/core/lib/stack.js:1:2544)
    at Module._compile (node:internal/modules/cjs/loader:1504:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1588:10) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/private/tmp/aws-cdk-test-20240718-31116-9aq66x/testapp/node_modules/aws-cdk-lib/core/lib/stack.js',
    '/private/tmp/aws-cdk-test-20240718-31116-9aq66x/testapp/node_modules/aws-cdk-lib/core/lib/index.js',
    '/private/tmp/aws-cdk-test-20240718-31116-9aq66x/testapp/node_modules/aws-cdk-lib/core/index.js',
    '/private/tmp/aws-cdk-test-20240718-31116-9aq66x/testapp/node_modules/aws-cdk-lib/index.js',
    '/private/tmp/aws-cdk-test-20240718-31116-9aq66x/testapp/bin/testapp.js'
  ]
}

Node.js v22.5.0

Expected Behavior

should pass

Current Behavior

failed

Reproduction Steps

  • install node 22.5.0
  • install cdk 2.149.0
  • run cdk init

Possible Solution

No response

Additional Information/Context

relates to Homebrew/homebrew-core#177645
full build log, https://github.com/Homebrew/homebrew-core/actions/runs/9980021240/job/27594462685?pr=177645

CDK CLI Version

2.149.0

Framework Version

No response

Node.js Version

22.5.0

OS

macOS/Linux

Language

TypeScript

Language Version

No response

Other information

No response

@chenrui333 chenrui333 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 18, 2024
@github-actions github-actions bot added the package/tools Related to AWS CDK Tools or CLI label Jul 18, 2024
@ashishdhingra
Copy link
Contributor

@chenrui333 Good morning. Thanks for opening the issue. Somehow the issue is not reproducible on fresh Amazon Linux 2023 instance using Nodejs 22.5.0 and CDK version 2.149.0 (build c8e5924). Running cdk init, after installing all the pre-requisites (I installed Nodejs using nvm per instructions at https://nodejs.org/en/download/package-manager/current and also installed typescript per https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html), gives the below output:

# Welcome to your CDK TypeScript project

This is a blank project for CDK development with TypeScript.

The `cdk.json` file tells the CDK Toolkit how to execute your app.

## Useful commands

* `npm run build`   compile typescript to js
* `npm run watch`   watch for changes and compile
* `npm run test`    perform the jest unit tests
* `npx cdk deploy`  deploy this stack to your default AWS account/region
* `npx cdk diff`    compare deployed stack with current state
* `npx cdk synth`   emits the synthesized CloudFormation template

Initializing a new git repository...
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint: 	git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint: 	git branch -m <name>
Executing npm install...
npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error   <https://github.com/npm/cli/issues>
npm error A complete log of this run can be found in: /home/ec2-user/.npm/_logs/2024-07-18T17_31_27_666Z-debug-0.log
✅ All done!

I noticed that you mentioned that this issue could be due to version of Homebrew. Could you please share what is the version of Homebrew installed on your system by running brew --version?

Thanks,
Ashish

@ashishdhingra ashishdhingra added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Jul 18, 2024
@avoidik
Copy link

avoidik commented Jul 19, 2024

nodejs has reported a problem in nodejs 22.5.0 with advice to rollback to 22.4.1, link

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jul 19, 2024
@ashishdhingra ashishdhingra added p2 effort/small Small work item – less than a day of effort labels Jul 19, 2024
@chenrui333
Copy link
Author

probably this issue, nodejs/node#53934

homebrew has shipped the node 22.5.1 (it works fine with that release), closing this report.

Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@aws-cdk-automation
Copy link
Collaborator

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.

@aws aws locked as resolved and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug. effort/small Small work item – less than a day of effort p2 package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

No branches or pull requests

4 participants