Skip to content
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

A ENOENT system error occurred #2

Open
jimmyseow opened this issue Dec 29, 2023 · 6 comments
Open

A ENOENT system error occurred #2

jimmyseow opened this issue Dec 29, 2023 · 6 comments

Comments

@jimmyseow
Copy link

I tried to create the jupyter datascience-notebook with all defaults

Command 'Dev Containers: Add Dev Container Configuration Files...'
resulted in an error

A system error occurred (ENOENT. no such file or directory, open
image

@jimmyseow
Copy link
Author

Forgot to mention that no devcontainer.json was created.

@ches
Copy link
Collaborator

ches commented Dec 29, 2023

I can reproduce, with slightly more error output from VS Code but not enough to be of much help—I filed microsoft/vscode-remote-release#9344 for the unhelpful failure mode.

I think this is a bug in the tooling for option value substitution, or else maybe we are supposed to encode option placeholders in a different way than ${templateOption:baseVariant} for additional files like the Dockerfile as opposed to devcontainer.json

The spec says (emphasis mine):

A supporting tool will parse the options object provided by the user. If a value is selected for a Template, it will be replaced in the files (within the sub-directory of the Template).

So substitution should work in all files, but I have not yet found any example in specs or another template in the wild that uses options in places other than the devcontainer.json. (Update: here's a test fixture, I only see it used for template packaging test cases and none for apply)

Triage Investigation

I installed the current release of the devcontainer CLI reference implementation, and a rudimentary example with only a devcontainer.json works fine:

$ devcontainer templates apply \
    -t ghcr.io/devcontainers/templates/debian \
    -a '{"imageVariant": "buster"}'
[1 ms] @devcontainers/cli 0.55.0. Node.js v21.5.0. darwin 22.6.0 x64.
{"files":["./.devcontainer/devcontainer.json"]}

but ours breaks for me, seemingly at the point of handling the Dockerfile because after the error I'm left with the expected .devcontainer/devcontainer.json but no sibling Dockerfile is written:

$ devcontainer templates apply \
    -t ghcr.io/devcontainers-community/templates/jupyter-datascience-notebooks \
    -a '{ "baseVariant": "minimal-notebook", "imageVariant": "latest" }'
[3 ms] @devcontainers/cli 0.55.0. Node.js v21.5.0. darwin 22.6.0 x64.

✂︎✂︎ SNIP HERE output of what looks to be the entire minified JS of the CLI app ✂︎✂︎


TypeError: Cannot read properties of undefined (reading '0')
    at /usr/local/Cellar/devcontainer/0.55.0/libexec/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:11:45532
    at Array.every (<anonymous>)
    at n (/usr/local/Cellar/devcontainer/0.55.0/libexec/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:11:45522)
    at o (/usr/local/Cellar/devcontainer/0.55.0/libexec/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:11:45603)
    at /usr/local/Cellar/devcontainer/0.55.0/libexec/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:11:46030
    at Set.forEach (<anonymous>)
    at s (/usr/local/Cellar/devcontainer/0.55.0/libexec/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:11:46019)
    at /usr/local/Cellar/devcontainer/0.55.0/libexec/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:11:45627
    at i (/usr/local/Cellar/devcontainer/0.55.0/libexec/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:11:53461)
    at /usr/local/Cellar/devcontainer/0.55.0/libexec/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:11:54533

Node.js v21.5.0

I'm not versed in Node.js debugging, I guess next steps would be giving it a source map for that dist version, or just go the CLI source repo and try creating a failing test case.

@ches
Copy link
Collaborator

ches commented Dec 29, 2023

Dug further, it's the same underlying issue as this: devcontainers/cli#699 (comment)

Different code path (we're not failing on Features), but same issue with the tar library choking on an archive containing spurious hard links. I followed the same exercise as that comment, and our published TAR looks like this:

$ tar --list -v -f ds-notebooks.tar
-rw-r--r--  0 runner docker   1070 Aug 17 08:23 devcontainer-template.json
drwxr-xr-x  0 runner docker      0 Aug 17 08:23 .devcontainer/
-rw-r--r--  0 runner docker   1600 Aug 17 08:23 .devcontainer/devcontainer.json
-rw-r--r--  0 runner docker    351 Aug 17 08:23 .devcontainer/Dockerfile
hrw-r--r--  0 runner docker      0 Aug 17 08:23 .devcontainer/Dockerfile link to .devcontainer/Dockerfile
hrw-r--r--  0 runner docker      0 Aug 17 08:23 .devcontainer/devcontainer.json link to .devcontainer/devcontainer.json

Not sure if there is something we can do to prevent this from happening in the build + deploy process, otherwise a fix would be waiting for upstream.

@jimmyseow
Copy link
Author

Thanks for your help. Will try and wait for a fix.

@ches
Copy link
Collaborator

ches commented Dec 30, 2023

@jimmyseow An unglamorous workaround in the meantime is to manually copy this repo's .devcontainer folder to your project, and edit the Dockerfile to use datascience-notebook – the FROM line is currently the only place where there is any template variable you'd need to fill in by hand.

@mejobloggs
Copy link

mejobloggs commented Mar 24, 2024

Same issue here sadly. Error: ENOENT: no such file or directory, open 'C:\Users\username\AppData\Local\Temp\tmp-output-dir-1711239583039.devcontainer\devcontainer.json'

I tried your manual method above but I get a different error.

Here is my empty project.

I copied Dockerfile and devcontainer.json from here: https://github.com/devcontainers-community/templates-jupyter-datascience-notebooks/tree/main/.devcontainer

Put inside .devcontainer folder.

Edited the FROM

image

When I try run in vscode, I get this error
Error: ENOENT: no such file or directory, open '/workspaces/imperial-machine/.devcontainer/Dockerfile'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants