Reputation: 2563
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
Upvotes: 5
Views: 2002
Reputation: 131
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)
Upvotes: 10