-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
‼️ NOTICE | CLI: cdk init
produces EACCES: permission denied
and does not fill the directory
#22090
Labels
bug
This issue is a bug.
management/tracking
Issues that track a subject or multiple issues
p0
package/tools
Related to AWS CDK Tools or CLI
Comments
jnawk
added
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
labels
Sep 17, 2022
Same problem here, only on version 2.42.0 2.41.0 is fine $ cdk init --language typescript
Applying project template app for typescript
Unable to create stream-cdk: EACCES: permission denied, mkdir '/usr/lib/node_modules/aws-cdk/lib/init-templates/app/tmp-stream-cdk'
Initializing a new git repository...
On branch main
Initial commit
nothing to commit (create/copy files and use "git add" to track)
Unable to initialize git repository for your project.
Executing npm install...
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/marcio/marcio/tests/stream-cdk/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/marcio/marcio/tests/stream-cdk/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/marcio/.npm/_logs/2022-09-17T13_36_02_592Z-debug-0.log
npm install failed: npm exited with status 254
✅ All done!
$ ls -la
total 16
drwxr-xr-x 3 marcio marcio 4096 Sep 17 10:42 .
drwxr-xr-x 12 marcio marcio 4096 Sep 17 10:19 ..
drwxr-xr-x 7 marcio marcio 4096 Sep 17 10:42 .git
-rw-r--r-- 1 marcio marcio 89 Sep 17 10:42 package-lock.json |
Same problem with python project too $ cdk init --language python
Applying project template app for python
Unable to create stream-cdk: EACCES: permission denied, mkdir '/usr/lib/node_modules/aws-cdk/lib/init-templates/app/tmp-stream-cdk'
Initializing a new git repository...
On branch main
Initial commit
nothing to commit (create/copy files and use "git add" to track)
Unable to initialize git repository for your project.
Please run 'python3 -m venv .venv'!
Executing Creating virtualenv...
✅ All done!
$ ls -la
total 16
drwxr-xr-x 4 marcio marcio 4096 Sep 17 10:39 .
drwxr-xr-x 12 marcio marcio 4096 Sep 17 10:19 ..
drwxr-xr-x 7 marcio marcio 4096 Sep 17 10:39 .git
drwxr-xr-x 6 marcio marcio 4096 Sep 17 10:39 .venv |
rix0rrr
changed the title
aws-cdk: can't init typescript app
CLI: Sep 19, 2022
cdk init
produces EACCES: permission denied
and does not fill the directory
iliapolo
changed the title
CLI:
(‼️ NOTICE) CLI: Sep 19, 2022
cdk init
produces EACCES: permission denied
and does not fill the directorycdk init
produces EACCES: permission denied
and does not fill the directory
iliapolo
changed the title
(‼️ NOTICE) CLI:
‼️ NOTICE | CLI: Sep 19, 2022
cdk init
produces EACCES: permission denied
and does not fill the directorycdk init
produces EACCES: permission denied
and does not fill the directory
iliapolo
added
management/tracking
Issues that track a subject or multiple issues
and removed
needs-triage
This issue or PR still needs to be triaged.
labels
Sep 19, 2022
iliapolo
added a commit
to cdklabs/aws-cdk-notices
that referenced
this issue
Sep 19, 2022
@jnawk Thanks for reporting. We are on it. |
rix0rrr
added a commit
that referenced
this issue
Sep 19, 2022
Historically, `cdk init` used to create a dedicated temporary directory for hook scripts and copy `*.hook.*` scripts into there. In #21049, the logic was changed to create that temporary directory inside the CLI source directory. If that CLI source directory is mounted in a read-only location (say, `/usr/lib/node_modules`) then that directory could not be created and `cdk init` would fail. It looks like historically we might copy and postprocess hook scripts so that they could have variables replaced... but given that hook scripts are code, they could just read the variables directly, so we don't have to copy them into a temporary directory at all: we can directly run them from the source location. Fixes #22090.
|
rix0rrr
added a commit
that referenced
this issue
Sep 19, 2022
Historically, `cdk init` used to create a dedicated temporary directory for hook scripts and copy `*.hook.*` scripts into there. In #21049, the logic was changed to create that temporary directory inside the CLI source directory. If that CLI source directory is mounted in a read-only location (say, `/usr/lib/node_modules`) then that directory could not be created and `cdk init` would fail. It looks like historically we might copy and postprocess hook scripts so that they could have variables replaced... but given that hook scripts are code, they could just read the variables directly, so we don't have to copy them into a temporary directory at all: we can directly run them from the source location. Fixes #22090.
mergify bot
pushed a commit
that referenced
this issue
Sep 20, 2022
Historically, `cdk init` used to create a dedicated temporary directory for hook scripts and copy `*.hook.*` scripts into there. In #21049, the logic was changed to create that temporary directory inside the CLI source directory. If that CLI source directory is mounted in a read-only location (say, `/usr/lib/node_modules`) then that directory could not be created and `cdk init` would fail. Historically, hook scripts were arbitrary scripts outside the scope of the CLI, but the previous change tried to reuse code from the CLI. That does not work because the CLI is now being bundled (all code and dependencies in one giant `.js` file), so reusing from the outside using a different entry point cannot work. (It's not clear that this is happening because we leave the source files in the original location inside the NPM package, to try and halfway not break people using the CLI in ways that are unsupported but happen to work). Instead, bundle the hook logic into the CLI itself, so it all uses the same mechanism. Fixes #22090. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
homakk
pushed a commit
to homakk/aws-cdk
that referenced
this issue
Dec 1, 2022
Historically, `cdk init` used to create a dedicated temporary directory for hook scripts and copy `*.hook.*` scripts into there. In aws#21049, the logic was changed to create that temporary directory inside the CLI source directory. If that CLI source directory is mounted in a read-only location (say, `/usr/lib/node_modules`) then that directory could not be created and `cdk init` would fail. Historically, hook scripts were arbitrary scripts outside the scope of the CLI, but the previous change tried to reuse code from the CLI. That does not work because the CLI is now being bundled (all code and dependencies in one giant `.js` file), so reusing from the outside using a different entry point cannot work. (It's not clear that this is happening because we leave the source files in the original location inside the NPM package, to try and halfway not break people using the CLI in ways that are unsupported but happen to work). Instead, bundle the hook logic into the CLI itself, so it all uses the same mechanism. Fixes aws#22090. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
This issue is a bug.
management/tracking
Issues that track a subject or multiple issues
p0
package/tools
Related to AWS CDK Tools or CLI
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:
Workaround: None. Don't install the CLI using
root
or inside aroot
owned directorySolution: 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
Current Behavior
Reproduction Steps
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
The text was updated successfully, but these errors were encountered: