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

deploy.sh script does not update environment node version #113

Open
phawxby opened this issue Nov 13, 2019 · 1 comment
Open

deploy.sh script does not update environment node version #113

phawxby opened this issue Nov 13, 2019 · 1 comment

Comments

@phawxby
Copy link

phawxby commented Nov 13, 2019

Yarn is now available on Azure App Service and we've been making use of it via this update applied here.

  cd "$DEPLOYMENT_TARGET"

  if [ -e "$DEPLOYMENT_TARGET/yarn.lock" ]; then
    echo "Running yarn install --production"

    yarn config delete proxy
    yarn install --production --network-timeout 300000
    exitWithMessageOnError "yarn install failed"
  else
    echo "Running $NPM_CMD install --production"
    eval $NPM_CMD install --production
    exitWithMessageOnError "$NPM_CMD install failed"
  fi

Up until recently this has worked just fine. When we updated our application to require Node 12 the install process failed because selectNodeVersion doesn't actually update the system level node version. So when calling yarn it then called node internally and it was seeing the system version of Node 10, even though selectNodeVersion had selected Node 12, and it failed.

Inversely it seems the system version of Node got updated in the US West region sometime before 11/11/19, which meant our master branch still requiring Node 10 failed to deploy in one region because Yarn was running with Node 12 but the app required Node 10.

As a temporary solution I did this.

  if [ -e "$DEPLOYMENT_TARGET/yarn.lock" ]; then
    echo "Running yarn install --production"
    NODE_DIR="$(dirname $NODE_EXE)";
    export NODE=$NODE_EXE
    export PATH=$NODE_DIR:$PATH

    yarn config delete proxy
    yarn install --production --network-timeout 300000
    exitWithMessageOnError "yarn install failed"
  else
    echo "Running $NPM_CMD install --production"
    eval $NPM_CMD install --production
    exitWithMessageOnError "$NPM_CMD install failed"
  fi

This works and got the app deploying again, but it feels wrong. Surely selectNodeVersion should be updating the environment node version during the selection process so any future commands are automatically executed against the correct version. IE, shouldn't something like NVM be used?

Thanks.

Premier support ticket: 119110125000210

@develohpanda
Copy link

An alternative approach would be to set the WEBSITE_NODE_DEFAULT_VERSION app setting / environment variable

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

2 participants