Skip to content

install.sh fails with npm when YARN_PATH environment variable is not defined #4724

Closed
@RobinzZH

Description

@RobinzZH

Installation of code-server via install.sh fails on docker images.

code-server/install.sh

Lines 422 to 423 in ad81a30

YARN_PATH="${YARN_PATH-yarn}"
NPM_PATH="${YARN_PATH-npm}"

Steps to Reproduce

$ docker run -it alpine
/ # apk add nodejs npm curl
...
/ # node -v
v14.18.1
/ # npm -v
7.17.0
/ # curl -fsSL https://code-server.dev/install.sh | sh
Alpine Linux v3.14
Installing latest from npm.

Please install npm or yarn to install code-server!
You will need at least node v12 and a few C dependencies.
See the docs https://coder.com/docs/code-server/latest/install#yarn-npm
/ # 

Expected

Code-server should get installed.

Actual

Installation fails and I get the following output:

# printenv 
  418  install_npm() {
  419    echoh "Installing latest from npm."
  420    echoh
  421
  422    YARN_PATH="${YARN_PATH-yarn}"
  423    NPM_PATH="${YARN_PATH-npm}"
  424
  425    echoh YARN_PATH=$YARN_PATH
  426    echoh NPM_PATH=$NPM_PATH
/ # sh ./install.sh 
Alpine Linux v3.14
Installing latest from npm.

YARN_PATH=yarn
NPM_PATH=yarn
Please install npm or yarn to install code-server!
You will need at least node v12 and a few C dependencies.
See the docs https://coder.com/docs/code-server/latest/install#yarn-npm
/ # 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions