Skip to content

‼️ NOTICE | CLI: cdk init produces EACCES: permission denied and does not fill the directory #22090

@jnawk

Description

@jnawk

Please add your +1 👍 to let us know you have encountered this

Status: RESOLVED

Overview:

Can't initialize a new app with v2.42.0

Complete Error Message:

cdk init app --language typescript
Applying project template app for typescript
Unable to create glove80-firmware-pipeline: EACCES: permission denied, mkdir '/usr/lib/node_modules/cdk/node_modules/aws-cdk/lib/init-templates/app/tmp-myapp'
Executing npm install...
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /path/to/myapp/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/path/to/myapp/package.json'
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!     /home/me/.npm/_logs/2022-09-17T09_26_32_543Z-debug-0.log
npm install failed: npm exited with status 254
✅ All done!

Workaround: None. Don't install the CLI using root or inside a root owned directory

Solution: Upgrade to 2.42.1


Original report:


Describe the bug

Can't bootstrap a new app with v2.42.0. v2.41.0 works fine.

Expected Behavior

$ cdk init -l typescript
Applying project template app for typescript
# Welcome to your CDK TypeScript project

This is a blank project for CDK development with TypeScript.

The `cdk.json` file tells the CDK Toolkit how to execute your app.

## Useful commands

* `npm run build`   compile typescript to js
* `npm run watch`   watch for changes and compile
* `npm run test`    perform the jest unit tests
* `cdk deploy`      deploy this stack to your default AWS account/region
* `cdk diff`        compare deployed stack with current state
* `cdk synth`       emits the synthesized CloudFormation template

Executing npm install...
✅ All done!

Current Behavior

$ cdk init app --language typescript
Applying project template app for typescript
Unable to create glove80-firmware-pipeline: EACCES: permission denied, mkdir '/usr/lib/node_modules/cdk/node_modules/aws-cdk/lib/init-templates/app/tmp-myapp'
Executing npm install...
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /path/to/myapp/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/path/to/myapp/package.json'
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!     /home/me/.npm/_logs/2022-09-17T09_26_32_543Z-debug-0.log
npm install failed: npm exited with status 254
✅ All done!

Reproduction Steps

$ cdk init app --language typescript

Possible Solution

Downgrade to 2.41.0

Additional Information/Context

No response

CDK CLI Version

2.42.0

Framework Version

2.42.0

Node.js Version

v16.17.0

OS

Ubuntu 22.04.1 LTS

Language

Typescript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.management/trackingIssues that track a subject or multiple issuesp0package/toolsRelated to AWS CDK Tools or CLI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions