templates-jupyter-datascience-notebooks icon indicating copy to clipboard operation
templates-jupyter-datascience-notebooks copied to clipboard

A ENOENT system error occurred

Open jimmyseow opened this issue 1 year ago • 6 comments

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 avatar Dec 29 '23 06:12 jimmyseow

Forgot to mention that no devcontainer.json was created.

jimmyseow avatar Dec 29 '23 06:12 jimmyseow

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 avatar Dec 29 '23 17:12 ches

Dug further, it's the same underlying issue as this: https://github.com/devcontainers/cli/issues/699#issuecomment-1857139272

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.

ches avatar Dec 29 '23 21:12 ches

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

jimmyseow avatar Dec 30 '23 02:12 jimmyseow

@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.

ches avatar Dec 30 '23 18:12 ches

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'

mejobloggs avatar Mar 24 '24 00:03 mejobloggs