Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

upgrading aws-cdk results in ENOENT error

Tags:

npm

aws-cdk

I already have cdk installed and works fine. When I try to update it by running

sudo npm install -g aws-cdk@latest

It gives me ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/aws-cdk/bin/cdk' error. When I check the path, cdk exists so I'm not sure why it is not able to find the file.

npm version: 7.5.2

cdk version: 1.86.0

like image 566
MoneyBall Avatar asked Feb 07 '21 08:02

MoneyBall


People also ask

How do I update my AWS CDK?

Upgrading from AWS CDK v2 Developer Preview Update these to 2.0. 0 , then update the modules installed in your project. After updating your dependencies, issue npm update -g aws-cdk to update the CDK Toolkit to the release version.

What is CDK context JSON?

The project file cdk. context. json is where the AWS CDK caches context values retrieved from your AWS account. This practice avoids unexpected changes to your deployments when, for example, a new Availability Zone is introduced.

Is not assignable to parameter of type construct?

In order to solve the "Argument of type is not assignable to parameter of type Construct" error in CDK, we have to: Update our CDK packages in the dependencies section in package. json to the same version. Remove the ^ (caret) symbol prefix from the versions.

How do I debug AWS CDK?

This is going to enable a CDK Debugger VSCode debug configuration: Once it's enabled, enable a breakpoint on the line you wish to debug by clicking on the left of the line number: Everything is ready now, you're free to start the debugger by clicking on the green arrow in the debug panel: And voila!


Video Answer


1 Answers

uninstall and re-install the cdk. it worked for me.

npm uninstall -g aws-cdk
npm install -g aws-cdk
[root@ip-172-31-42-6 ~]# cdk --version
internal/modules/cjs/loader.js:670
    throw err;
    ^

Error: Cannot find module 'source-map-support/register'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)
    at Function.Module._load (internal/modules/cjs/loader.js:591:27)
    at Module.require (internal/modules/cjs/loader.js:723:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at Object.<anonymous> (/usr/lib/node_modules/aws-cdk/bin/cdk.js:4:1)
    at Module._compile (internal/modules/cjs/loader.js:816:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
    at Module.load (internal/modules/cjs/loader.js:685:32)
    at Function.Module._load (internal/modules/cjs/loader.js:620:12)
    at Module.require (internal/modules/cjs/loader.js:723:19)
[root@ip-172-31-42-6 ~]# npm uninstall -g aws-cdk
removed 1 package, and audited 1 package in 412ms
found 0 vulnerabilities
[root@ip-172-31-42-6 ~]#
[root@ip-172-31-42-6 ~]# npm install -g aws-cdk
added 191 packages, and audited 192 packages in 4s
found 0 vulnerabilities
[root@ip-172-31-42-6 ~]# cdk --version
1.89.0 (build df7253c)
like image 171
krishdd2 Avatar answered Oct 07 '22 03:10

krishdd2