locked
Azure App Service - Node.js - yarn install fails RRS feed

  • Question

  • Hey Azure Support Team,

    I'm trying to deploy a nodejs application in Azure App Service but it fails to install packages with the following error "An unexpected error occurred: "EBADF: bad file descriptor, copyfile '/usr/local/share/.cache/yarn/v4/npm-@babel-runtime-7.9.6-a9102eb5cadedf3f31d08a9ecf294af7827ea29f"

    The applications installs just fine in Docker and on our local machines but is causing issue in Azure App Service. Is there a way I could get help with this? Thank you very much in advance

    Something else I observed:

    1. If I deploy, I have to run "yarn install" before my packages are installed. I do this by changing my npm start script to install before running.

    2. If I do not also run "yarn cache clean" the installation of another package fails "EBADF: bad file descriptor, copyfile '/usr/local/share/.cache/yarn/v4/npm-accepts-1.3.7-531bc726517a3b2b41f850021c6cc15eaab507cd/node_modules/accepts/HISTORY.md"

    3. If i also run yarn cache clean, I get stuck at the babel package or after reinstalling another random package wiith the same "bad file descriptor" error Thank you so much for any help you can offer!

    Monday, May 25, 2020 8:07 PM

All replies

  • Hi Alex,

    I would like for you to try the following steps. Also, which version of node are you currently using? Can you provide your packages.json file as well?

    1. Remove the local yarn.lock file if it exists
    2. Copy your application contents to the wwwroot folder of the app service without using any deployment tools
    3. Login into the kudu portal of your app service if you haven't already and navigate to the wwwroot folder
    4. Run npm install -g yarn
    5. Run yarn install --production
    6. Assuming the install was successful, add <add name="iisnode" path="bin/www" verb="*" modules="iisnode"/> to <system.webserver> of the web.config. If web.config doesn't exist, create a new one in the same directory as your node.js entry file. 

    Let me know if you are able to run your application.


    Thanks in advance, Ryan

    Wednesday, May 27, 2020 12:19 AM
  • Hi Ryan,

    thanks for your suggestions!

    I was briefly able to connect and was able to run npm install -g yarn but shortly after got disconnected.
    Today was the first time I was able to open a Webssh session. Right after I ran yarn install --production, I was disconnected and received the usual error I can no longer connect at all (Not via cloudssh or the azure cli):

    SSH CONNECTION CLOSE - Error: connect EHOSTUNREACH 172.16.0.2:2222


     
    WAITING FOR WEBAPP TO COLD START
     

    DebugConsole is still accessible and has always been reliable to me

    Something I noticed here was that the newly installed version of yarn is the same I have installed locally (1.22.4) while before I recall seeing yarn 1.17.3 (Using bash / KUDU's DebugConsole)

    I am able to reconnect by stopping the app service and starting it again (Restart does not help) but again, it will disconnect in the middle of my yarn install

    You can find my package.json below:

    {
    "name": "",
    "version": "1.0.0",
    "main": "",
    "scripts": {
    "start": "node bin/www",
    "build": "tsc"
    },
    "engines": {
    "node": "12.*.*"
    },
    "author": "",
    "license": "ISC",
    "dependencies": {
    "@babel/runtime": "^7.9.6",
    "@sendgrid/mail": "^7.0.1",
    "@types/express": "^4.17.2",
    "@types/image-size": "^0.8.0",
    "@types/morgan": "^1.9.0",
    "@types/node": "^13.7.4",
    "@types/yup": "^0.26.32",
    "axios": "^0.19.2",
    "azure-storage": "^2.10.3",
    "cors": "^2.8.5",
    "debug": "~2.6.9",
    "express": "~4.17.1",
    "": "link:./common",
    "image-size": "^0.8.3",
    "knex": "^0.20.10",
    "morgan": "^1.9.1",
    "pg": "^7.18.2",
    "rocketchat-client-node": "^1.1.0",
    "typescript": "^3.8.3",
    "uuid": "^7.0.2",
    "yup": "^0.28.1"
    },
    "devDependencies": {
    "@types/cors": "^2.8.6",
    "@types/mocha": "^7.0.2",
    "mocha": "^7.1.0"
    }
    }

    Wednesday, May 27, 2020 6:58 AM