(cli): Mac Homebrew-installed Node interferes with Python CDK applications
See original GitHub issueBug
I have a basic Python CDK application with all the dependencies installed inside a Python virtual env. From the CLI while inside the virtual env, I can cdk synth
my app successfully and cdk deploy
correctly starts the deployment process. However, using a cdk-deploy-to
script from here, which calls npx cdk deploy
, I get the following error:
Traceback (most recent call last):
File "/REMOVED/app.py", line 4, in <module>
from aws_cdk import (
ModuleNotFoundError: No module named 'aws_cdk'
Subprocess exited with error 1
Calling npx cdk deploy
yields the same error. Somehow invoking cdk
through npx
is using a different environment.
Environment
- CDK CLI Version:
1.116.0 (build d04661d)
- Node.js Version:
v14.13.1
- OS :
macOS 11.5.1
- Language (Version):
Python 3.7
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:28 (6 by maintainers)
Top Results From Across the Web
Working with the AWS CDK in Python
To work with the AWS CDK, you must have an AWS account and credentials and have installed Node.js and the AWS CDK Toolkit....
Read more >aws-cdk - Homebrew Formulae
aws-cdk. Install command: brew install aws-cdk. AWS Cloud Development Kit - framework for defining AWS infra as code. https://github.com/aws/aws-cdk.
Read more >Lessons in AWS Python CDK: 1-Getting Started
Using npm. AWS suggests installing with npm (Node Package Manager). Thats fine. Just go to your terminal and make sure you have it...
Read more >env: node: No such file or directory in mac - Stack Overflow
Install npm using the following command: npm install -g grunt ... I got such a problem after I upgraded my node version with...
Read more >How to install NodeJS and NPM on Mac using Homebrew
Step 1: Install Homebrew. Homebrew is "The missing package manager for macOS". Open terminal and type the following command. $ /usr/bin/ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Playing some more around with this, I tried changing cdk.json:
That results in
cdk ls
working as well.Finding this a bit strange, as this command works:
Vastly prefer this over the other workaround I mention above. Curious if this works for others here.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or 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.