0

estoy intentando implementar un backend en un AWS ElasticBeanstalk Node.js 12 running on 64bit Amazon Linux 2/5.2.3 mas marca un error al parecer en bcrypt y truena el build...

Package.json:

  "scripts": {
    "start": "node .",
    "test": "jest",
    "coverage": "npm test -- --coverage",
    "postcoverage": "opn coverage/lcov-report/index.html",
    "dev": "nodemon -i \"*.test.js\" .",
    "prod": "cross-env NODE_ENV=production nodemon -i \"*.test.js\" -r dotenv-safe/config .",
    "lint": "eslint src",
    "docs": "apidoc -i src -o docs && apidoc-markdown -p docs -o DOCS.md",
    "postdocs": "open-cli docs/index.html"
  },
  "engines": {
    "node": "12.14.0"
  },
  "jest": {
    "testEnvironment": "node",
    "setupFilesAfterEnv": [
      "<rootDir>/test/setup.js"
    ]
  },
  "devDependencies": {
    "apidoc": "^0.20.0",
    "apidoc-markdown": "^0.2.1",
    "babel-eslint": "^10.1.0",
    "babel-jest": "^25.1.0",
    "cross-env": "^7.0.2",
    "dotenv-safe": "^8.2.0",
    "eslint": "^6.8.0",
    "eslint-config-standard": "^14.1.0",
    "eslint-plugin-import": "^2.20.0",
    "eslint-plugin-node": "^11.0.0",
    "eslint-plugin-promise": "^4.2.0",
    "eslint-plugin-standard": "^4.0.1",
    "jest-cli": "^25.1.0",
    "mongodb-memory-server": "^6.3.3",
    "nock": "^12.0.2",
    "nodemon": "^2.0.2",
    "open-cli": "^6.0.0",
    "sinon": "^4.0.1",
    "supertest": "^4.0.2"
  },
  "dependencies": {
    "@babel/core": "^7.8.4",
    "@babel/plugin-proposal-export-default-from": "^7.8.3",
    "@babel/plugin-transform-runtime": "^7.8.3",
    "@babel/preset-env": "^7.8.4",
    "@babel/register": "^7.8.3",
    "@babel/runtime": "^7.8.4",
    "@sendgrid/mail": "^6.5.4",
    "bcrypt": "^5.0.0",
    "bluebird": "^3.7.2",
    "body-parser": "^1.19.0",
    "bodymen": "^1.1.1",
    "compression": "^1.7.4",
    "cors": "^2.8.5",
    "dayjs": "^1.9.6",
    "express": "^4.17.1",
    "jsonwebtoken": "^8.5.1",
    "mongoose": "^5.9.4",
    "mongoose-keywords": "^0.4.0",
    "morgan": "^1.9.1",
    "passport": "^0.4.1",
    "passport-http": "^0.3.0",
    "passport-http-bearer": "^1.0.1",
    "passport-jwt": "^4.0.0",
    "querymen": "^2.1.4",
    "rand-token": "^0.4.0",
    "request": "^2.88.2",
    "request-promise": "^4.2.5"
  }
}

Console log: Failed to execute '/opt/elasticbeanstalk/node-install/node-v12.9.1-linux-x64/bin/node /opt/elasticbeanstalk/node-install/node-v12.9.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/var/app/staging/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/var/app/staging/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=4 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)

full console log: https://elasticbeanstalk-us-east-1-851540085043.s3.amazonaws.com/resources/environments/logs/tail/e-m62m2tfndy/i-001cc27b5be77394e/TailLogs-1607097192790.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20201204T155314Z&X-Amz-SignedHeaders=host&X-Amz-Expires=86400&X-Amz-Credential=AKIAIOUOORMVUTXOJUHQ%2F20201204%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=a2e91e25cf5b0abccbd574807fbe41f3d960587a0bc318551ddab2d7ecd23439

1
  • Hola, Andres. Bienvenidx a SOes. Por favor, traduce la pregunta Y el título a español, que es el idioma oficial
    – Alfabravo
    Commented el 4 dic. 2020 a las 16:02

1 respuesta 1

0

Es muy posible que sea debido a una diferencia entre las versiones de node en tu package.json y la que está instalada en el ambiente de ElasticBeanstalk.

Al ver el error aparece que tu EB tiene la versión v12.9.1 de node (/opt/elasticbeanstalk/node-install/node-v12.9.1-linux-x64/(...)) mientras que tu package.json especifica la v12.14.0 .

Modifica el engine en tu package.json para que quede

...
"engines": {
    "node": "12.9.1"
},
...

y debería funcionar

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.