question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

npm ci fails on trying to chmod bin/cdk

See original GitHub issue

I use containers in my CI/CD pipeline that have specific versions of CDK globally preinstalled. When running npm ci I get this error

$ npm ci
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /builds/reporting/sepa_service/node_modules/aws-cdk/bin/cdk
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/builds/reporting/sepa_service/node_modules/aws-cdk/bin/cdk'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! A complete log of this run can be found in:
npm ERR!     /build/.npm/_logs/2021-01-05T13_09_59_080Z-debug.log

Note that the container is pristine, there’s no node_modules folder yet.

Here are my devDependencies:

  "devDependencies": {
    "@aws-cdk/assert": "1.79.0",
    "@types/jest": "^26.0.10",
    "@types/node": "10.17.27",
    "aws-cdk": "1.79.0",
    "jest": "^26.6.3",
    "ts-jest": "^26.2.0",
    "ts-node": "^9.0.0",
    "typescript": "~3.9.7"
  },

I’ve already tried different versions of CDK, more recent versions of the dependent libraries - it doesn’t work.

To the best of my knowledge I have started observing this behaviour since upgrading to npm 7.3.0 (from 6.14.5), going back to an older version didn’t change the behavious.

Here’s now the folder in question looks like when the install fails:

ls -l node_modules/aws-cdk/
drwxr-xr-x 157 build build 5024 Jan  5 13:53 node_modules

Environment

  • CDK CLI Version : 1.18.147
  • Framework Version: 1.79.0
  • Node.js Version: v14.4.0
  • OS : Amazon Linux 2 container
  • Language (Version): TypeScript (3.9.7)

This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:20
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

9reactions
Blufecommented, Feb 20, 2021

I also happened with NPM (7.5.3 | 7.5.4) and CDK (1.90.0 | 1.90.1). Earlier CDK versions worked fine.

Update) After setting NPM 7.5.4 and CDK 1.90.1 and executing the following command, the installation was successful.

rm -rf node_modules package-lock.json 
npm cache clean -f
npm install
2reactions
mrgraincommented, Mar 5, 2021

npm 7.5.5+ and 7.6.0+ solved this issue for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm install errors with Error: ENOENT, chmod - Stack Overflow
Every time I try to install, either from npm or the folder, I get this error. npm ERR! Error: ENOENT, chmod '/usr/local/lib/node_modules/takeapeek/lib ...
Read more >
npm-ci
This command is similar to npm install , except it's meant to be used in automated environments such as test platforms, continuous integration,...
Read more >
How to fix: npm ERR! enoent ENOENT: no such file or ...
Finally, I found a solution and a reason for that issue. The error occurred when I was trying to install @testing-library/react npm package....
Read more >
chmod - Manual - PHP
You can also read more about modes on Unix systems with 'man 1 chmod' and ... I was trying to change permissions of...
Read more >
Docker: Permission error - Code with Mosh Forum
I get this error f… ... Try using npm ci rather than npm install… ... Hahahaha the chmod 777 part cracks me up...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found