Reputation: 159
I am installing aws-cdk on windows using powershell,
First I was getting Error : "\AppData\Roaming\npm' npm ERR! enoent This is related to npm not being able to find a file."
during installation. I fixed that by creating folder "\AppData\Roaming\npm" as recommended by some solution.
Now my installation is successful with "npm i -g aws-cdk". No error reported,
but when I do "cdk --version" I am getting "cdk : The term 'cdk' is not recognized as the name of a cmdlet, function, script file, or operable program."
"npm -g ls --depth=0" returns C:\Users<username>\AppData\Roaming\npm `-- [email protected]
Upvotes: 9
Views: 14763
Reputation: 3
Problem: Unable to install CDK in PyCharm.
Solution:
Create a new directory and initialize a CDK app:
mkdir test-cdk
cd test-cdk
cdk init app --language python
Activate the virtual environment:
source .venv/bin/activate
Install dependencies:
python -m pip install -r requirements.txt
Open the project in PyCharm:
Configure PyCharm's Python interpreter:
Note: Ensure that your virtual environment is activated before running PyCharm to access the installed CDK packages.
Upvotes: 0
Reputation: 264
Adding the following to the path variable within the user environment variables and restarting the terminal worked for me:
%USERPROFILE%\AppData\Roaming\npm;
Upvotes: 0
Reputation: 16309
On windows, make sure you don't have two versions of node in your path. For example, after installing latest node, I was having issues with cdk
. Then I typed
where.exe node
Only to find it had been installed implicitly with another windows program
C:\Program Files\Microsoft HPC Pack 2012\Bin\node.exe
I had to put the correct node earlier in the path - the order of path variables determines priority.
Upvotes: 0
Reputation: 61
I used npx cdk --version
instead of cdk --version
and it worked.
Upvotes: 3
Reputation: 2169
If you made the mistake of installing cdk with pip at some point in time, make sure to remove it.
pip uninstall cdk
You could check if you have it installed with:
pip list | grep cdk
Upvotes: -1
Reputation: 99
Install AWS-CDK:
npm i -g aws-cdk
run below command to set path of environment variable:
setx PATH "D:\Users\<username>\AppData\Roaming\npm"
close the command prompt once above command successfully executed.
open command prompt as new session and run below command:
cdk --version
Upvotes: 9
Reputation: 159
The above solution may work, but I was able to make mine work by adding "\AppData\Roaming\npm" to user Path variable.
Upvotes: 2
Reputation: 70075
There are many reasons this could be happening, some of them likely Windows-specific. It is probably worth it to chase down the issue, but for a quick "just get the command running" solution, you can use npx
to install-and-execute rather than npm
to install.
$ npx -p aws-cdk cdk --version
1.72.0 (build c2f38e8)
$
Upvotes: 8