cli
cli copied to clipboard
Failed to fetch local disk feature on Windows
On Windows Dev Containers v0.266.1 local features prevent devcontainer from building.
With this folder structure in E:\Projects\test-local-feature
devcontainer.json
{
"name": "test local feature",
"image": "mcr.microsoft.com/devcontainers/base:bullseye",
"features": {
"./local-features/test": {}
}
}
devcontainer-feature.json
{
"id": "test",
"name": "test",
"options": { }
}
install.sh
echo HERE!
Trying to open the container fails with
[2022-12-09T00:08:27.167Z] * Processing feature: ./local-features/test
[2022-12-09T00:08:27.167Z] Local disk feature.
[2022-12-09T00:08:27.167Z] * Fetching feature: test_1_file-path
[2022-12-09T00:08:27.168Z] (!) ERR: Failed to fetch feature:
[2022-12-09T00:08:27.168Z] Error: ENOENT: no such file or directory, lstat 'c:\e:\Projects\test-local-feature\.devcontainer\local-features\test'
Looking at the code it looks like the path to the local feature configuration is being passed to processFeatureIdentifier with a leading , i.e. instead of E:\Projects\test-local-feature.devcontainer\local-features\test it was \E:\Projects\test-local-feature.devcontainer\local-features\test. When this path is eventually passed to the ncp function to copy the feature files the drive of vscode's working directory c:\ is prepended resulting in a path to a file that doesn't exist.
The vscode-uri object has an fsPath property which its documentation says should be used for file system paths instead of the path property, using that property on this line seems to fix the issue in my extremely limited attempt at testing it. https://github.com/devcontainers/cli/blob/93cb111e4276d202fca1244fe034cb6d6d60196c/src/spec-configuration/containerFeaturesConfiguration.ts#L552