npm install errors with Error: ENOENT, chmod

Ok it looks like NPM is using your .gitignore as a base for the .npmignore file, and thus ignores /lib. If you add a blank .npmignore file into the root of your application, everything should work.

A better, more explicit approach is to use an allow-list rather than a disallow-list, and use the “files” field in package.json to specify the files in your package.

[edit] – more info on this behaviour here: https://docs.npmjs.com/cli/v7/using-npm/developers#keeping-files-out-of-your-package

Leave a Comment