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

failed to build with error: bash: "/usr/local/share/nvm/nvm.sh: No such file or directory" #1078

Open
SouthWest7 opened this issue Aug 5, 2024 · 7 comments · May be fixed by #1114
Open

Comments

@SouthWest7
Copy link

When I try to open the folder in devcontainer, feature "Node.js (via nvm), yarn and pnpm" (ghcr.io/devcontainers/features/node) failed to install!
logs follows:

[+] Building 442.3s (17/18)                                                                    docker:desktop-linux
 => [internal] load build definition from Dockerfile.extended                                                  0.0s
 => => transferring dockerfile: 4.80kB                                                                         0.0s
 => resolve image config for docker-image://docker.io/docker/dockerfile:1.4                                    2.6s
 => [auth] docker/dockerfile:pull token for registry-1.docker.io                                               0.0s
 => CACHED docker-image://docker.io/docker/dockerfile:1.4@sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c  0.0s
 => [internal] load .dockerignore                                                                              0.0s
 => => transferring context: 2B                                                                                0.0s
 => [context dev_containers_feature_content_source] load .dockerignore                                         0.0s
 => => transferring dev_containers_feature_content_source: 2B                                                  0.0s
 => [internal] load metadata for mcr.microsoft.com/vscode/devcontainers/base:ubuntu                            0.0s
 => [context dev_containers_feature_content_source] load from client                                           0.1s
 => => transferring dev_containers_feature_content_source: 170.74kB                                            0.0s
 => CACHED [dev_containers_feature_content_normalize 1/3] FROM mcr.microsoft.com/vscode/devcontainers/base:ub  0.0s
 => [dev_containers_feature_content_normalize 2/3] COPY --from=dev_containers_feature_content_source devconta  0.0s
 => [dev_containers_feature_content_normalize 3/3] RUN chmod -R 0755 /tmp/build-features/                      0.3s
 => CACHED [dev_containers_target_stage 2/8] RUN mkdir -p /tmp/dev-container-features                          0.0s
 => CACHED [dev_containers_target_stage 3/8] COPY --from=dev_containers_feature_content_normalize /tmp/build-  0.0s
 => CACHED [dev_containers_target_stage 4/8] RUN echo "_CONTAINER_USER_HOME=$( (command -v getent >/dev/null   0.0s
 => [dev_containers_target_stage 5/8] RUN --mount=type=bind,from=dev_containers_feature_content_source,sour  298.0s
 => [dev_containers_target_stage 6/8] RUN --mount=type=bind,from=dev_containers_feature_content_source,sour  138.8s
 => ERROR [dev_containers_target_stage 7/8] RUN --mount=type=bind,from=dev_containers_feature_content_source,  2.2s
------
 > [dev_containers_target_stage 7/8] RUN --mount=type=bind,from=dev_containers_feature_content_source,source=node_2,
target=/tmp/build-features-src/node_2     cp -ar /tmp/build-features-src/node_2 /tmp/dev-container-features  && chmo
d -R 0755 /tmp/dev-container-features/node_2  && cd /tmp/dev-container-features/node_2  && chmod +x ./devcontainer-f
eatures-install.sh  && ./devcontainer-features-install.sh  && rm -rf /tmp/dev-container-features/node_2:
0.472 ===========================================================================
0.472 Feature       : Node.js (via nvm), yarn and pnpm
0.472 Description   : Installs Node.js, nvm, yarn, pnpm, and needed dependencies.
0.472 Id            : ghcr.io/devcontainers/features/node
0.472 Version       : 1.5.0
0.472 Documentation : https://github.com/devcontainers/features/tree/main/src/node
0.472 Options       :
0.472     VERSION="20"
0.472     NODEGYPDEPENDENCIES="true"
0.472     NVMINSTALLPATH="/usr/local/share/nvm"
0.472     NVMVERSION="latest"
0.472     INSTALLYARNUSINGAPT="true"
0.472 ===========================================================================
1.585 NVM_VERSION=0.40.0
2.150 bash: line 10: /usr/local/share/nvm/nvm.sh: No such file or directory
2.152 ERROR: Feature "Node.js (via nvm), yarn and pnpm" (ghcr.io/devcontainers/features/node) failed to install! Loo
k at the documentation at https://github.com/devcontainers/features/tree/main/src/node for help troubleshooting this
 error.
------
Dockerfile.extended:46
--------------------
  45 |     ENV PATH="/usr/local/share/nvm/current/bin:${PATH}"
  46 | >>> RUN --mount=type=bind,from=dev_containers_feature_content_source,source=node_2,target=/tmp/build-features
-src/node_2 \
  47 | >>>     cp -ar /tmp/build-features-src/node_2 /tmp/dev-container-features \
  48 | >>>  && chmod -R 0755 /tmp/dev-container-features/node_2 \
  49 | >>>  && cd /tmp/dev-container-features/node_2 \
  50 | >>>  && chmod +x ./devcontainer-features-install.sh \
  51 | >>>  && ./devcontainer-features-install.sh \
  52 | >>>  && rm -rf /tmp/dev-container-features/node_2
  53 |
--------------------
ERROR: failed to solve: process "/bin/sh -c cp -ar /tmp/build-features-src/node_2 /tmp/dev-container-features  && ch
mod -R 0755 /tmp/dev-container-features/node_2  && cd /tmp/dev-container-features/node_2  && chmod +x ./devcontainer
-features-install.sh  && ./devcontainer-features-install.sh  && rm -rf /tmp/dev-container-features/node_2" did not c
omplete successfully: exit code: 1

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/x34a9w99lqcaz2fh5ns6zxol8
[470324 ms] Error: Command failed: docker buildx build --load --build-context dev_containers_feature_content_source=C:\Users\lenovo\AppData\Local\Temp\devcontainercli\container-features\0.65.0-1722871649534 --build-arg _DEV_CONTAINERS_BASE_IMAGE=mcr.microsoft.com/vscode/devcontainers/base:ubuntu --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -f C:\Users\lenovo\AppData\Local\Temp\devcontainercli\container-features\0.65.0-1722871649534\Dockerfile.extended -t vsc-argo-workflows-8d0ca60f7a31f10ab8c56cae166822b509389b6a37d922f75931f6dcee78ad0b-features c:\Users\lenovo\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data\empty-folder
[470324 ms]     at ptA (c:\Users\lenovo\.vscode\extensions\ms-vscode-remote.remote-containers-0.380.0\dist\spec-node\devContainersSpecCLI.js:465:1260)
[470324 ms]     at NH (c:\Users\lenovo\.vscode\extensions\ms-vscode-remote.remote-containers-0.380.0\dist\spec-node\devContainersSpecCLI.js:465:1002)
[470325 ms]     at async KtA (c:\Users\lenovo\.vscode\extensions\ms-vscode-remote.remote-containers-0.380.0\dist\spec-node\devContainersSpecCLI.js:482:3771)
[470325 ms]     at async eB (c:\Users\lenovo\.vscode\extensions\ms-vscode-remote.remote-containers-0.380.0\dist\spec-node\devContainersSpecCLI.js:482:4886)
[470325 ms]     at async hrA (c:\Users\lenovo\.vscode\extensions\ms-vscode-remote.remote-containers-0.380.0\dist\spec-node\devContainersSpecCLI.js:663:200)
[470325 ms]     at async lrA (c:\Users\lenovo\.vscode\extensions\ms-vscode-remote.remote-containers-0.380.0\dist\spec-node\devContainersSpecCLI.js:662:13452)
[470340 ms] Exit code 1
[470371 ms] Command failed: C:\Users\lenovo\AppData\Local\Programs\Microsoft VS Code\Code.exe c:\Users\lenovo\.vscode\extensions\ms-vscode-remote.remote-containers-0.380.0\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\lenovo\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --container-session-data-folder /tmp/devcontainers-2f2be18d-f101-48cd-81f5-da56c87dd95f1722871642032 --workspace-folder c:\Users\lenovo\Desktop\argo\argo-workflows --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\Users\lenovo\Desktop\argo\argo-workflows --id-label devcontainer.config_file=c:\Users\lenovo\Desktop\argo\argo-workflows\.devcontainer\devcontainer.json --log-level debug --log-format json --config c:\Users\lenovo\Desktop\argo\argo-workflows\.devcontainer\devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --mount type=bind,source=\\wsl.localhost\Ubuntu\mnt\wslg\runtime-dir\wayland-0,target=/tmp/vscode-wayland-4a4e9504-bf15-495e-86b2-dd6be4efbe37.sock --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root --terminal-columns 116 --terminal-rows 13 --include-configuration --include-merged-configuration
[470372 ms] Exit code 1
@samruddhikhandale
Copy link
Member

@prathameshzarkar9 Can you help investigate this? thanks!

@gvatsal60
Copy link
Contributor

Hi @SouthWest7
Can I get to know more on your devcontainer.json configuration ?

With this configuration I unable to reproduce the error.
{ "image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu", "features": { "ghcr.io/devcontainers/features/node": {} }, "customizations": { "vscode": { "extensions": [ "mads-hartmann.bash-ide-vscode" ] } } }

@SouthWest7
Copy link
Author

The content of my devcontainer.json as follows:

{
  "image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu",
  "appPort": 8080,
  "features": {
    "ghcr.io/devcontainers/features/go:1": {
      "version": "1.22"
    },
    "ghcr.io/devcontainers/features/node:1": {
      "version": "20"
    },
    "ghcr.io/devcontainers/features/docker-in-docker:2": {},
    "ghcr.io/devcontainers/features/python:1": {}
  },
  "forwardPorts": [9000, 9001, 9090, 2746, 8080, 5556, 6060, 9091, 3306, 5432, 10000],
  "hostRequirements": {
    "cpus": 4
  },
  "runArgs": [
    "--add-host=host.docker.internal:host-gateway",
    "--add-host=dex:127.0.0.1",
    "--add-host=minio:127.0.0.1",
    "--add-host=postgres:127.0.0.1",
    "--add-host=mysql:127.0.0.1",
    "--add-host=azurite:127.0.0.1"
  ],
  "postCreateCommand": ".devcontainer/pre-build.sh",
  "workspaceMount": "source=${localWorkspaceFolder},target=/home/vscode/go/src/github.com/argoproj/argo-workflows,type=bind",
  "workspaceFolder": "/home/vscode/go/src/github.com/argoproj/argo-workflows",
  "remoteEnv": {
    "PATH": "${containerEnv:PATH}:/home/vscode/go/bin",
    "GOPATH": "/home/vscode/go"
  }
}

@gvatsal60
Copy link
Contributor

The content of my devcontainer.json as follows:

{
  "image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu",
  "appPort": 8080,
  "features": {
    "ghcr.io/devcontainers/features/go:1": {
      "version": "1.22"
    },
    "ghcr.io/devcontainers/features/node:1": {
      "version": "20"
    },
    "ghcr.io/devcontainers/features/docker-in-docker:2": {},
    "ghcr.io/devcontainers/features/python:1": {}
  },
  "forwardPorts": [9000, 9001, 9090, 2746, 8080, 5556, 6060, 9091, 3306, 5432, 10000],
  "hostRequirements": {
    "cpus": 4
  },
  "runArgs": [
    "--add-host=host.docker.internal:host-gateway",
    "--add-host=dex:127.0.0.1",
    "--add-host=minio:127.0.0.1",
    "--add-host=postgres:127.0.0.1",
    "--add-host=mysql:127.0.0.1",
    "--add-host=azurite:127.0.0.1"
  ],
  "postCreateCommand": ".devcontainer/pre-build.sh",
  "workspaceMount": "source=${localWorkspaceFolder},target=/home/vscode/go/src/github.com/argoproj/argo-workflows,type=bind",
  "workspaceFolder": "/home/vscode/go/src/github.com/argoproj/argo-workflows",
  "remoteEnv": {
    "PATH": "${containerEnv:PATH}:/home/vscode/go/bin",
    "GOPATH": "/home/vscode/go"
  }
}

@SouthWest7 Still I unable to reproduce the error with your devcontainer.json, Let me debug more specific to Node feature...

@SouthWest7
Copy link
Author

When I install mannually it also occurs, so the problem has no relationship with devcontainer, I copy the file to the directory on my laptop, the install script works.

@gvatsal60 gvatsal60 linked a pull request Sep 5, 2024 that will close this issue
@gvatsal60
Copy link
Contributor

I got the problem it's in the install script.

I gave a ran on a container to install node using nvm

root@33c865f97ec1:/# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 16555 100 16555 0 0 7426 0 0:00:02 0:00:02 --:--:-- 7427
=> Downloading nvm as script to '/root/.nvm'

=> Appending nvm source string to /root/.bashrc
=> Appending bash_completion source string to /root/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion

Please check the bold lines it's been clearly mentioned either open a new terminal else source nvm.sh

@gvatsal60
Copy link
Contributor

@samruddhikhandale
I have raised a PR(#1114), Please have a look on it.

@samruddhikhandale samruddhikhandale linked a pull request Sep 25, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants