Search code examples
node.jsheroku

node.js deploy to Heroku fails: string.prototype.trimend not accessible from es-abstract


Did git push heroku main un my Mac and it failed.

Any idea, what's going wrong here? Searched for the error message string.prototype.trimend not accessible from es-abstract, tried npm i [email protected] with the same result.

-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       
-----> Installing binaries
       engines.node (package.json):  14.x
       engines.npm (package.json):   unspecified (use default)
       
       Resolving node version 14.x...
       Downloading and installing node 14.17.3...
       Using default npm version: 6.14.13
       
-----> Installing dependencies
       Installing node modules
       npm ERR! string.prototype.trimend not accessible from es-abstract
       
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /tmp/npmcache.4RKEc/_logs/2021-07-16T05_48_57_134Z-debug.log
-----> Build failed
       
       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys
       
       If you're stuck, please submit a ticket so we can help:
       https://help.heroku.com/
       
       Love,
       Heroku
       
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

package.json

{
 "name": "shopify-app-node",
 "version": "1.0.0",
 "description": "Shopify's node app for CLI tool",
 "engines": {
   "node": "14.x"
 },
 "scripts": {
   "test": "jest",
   "dev": "cross-env NODE_ENV=development nodemon ./server/index.js --watch ./server/index.js",
   "build": "NEXT_TELEMETRY_DISABLED=1 next build",
   "start": "cross-env NODE_ENV=production node ./server/index.js"
 },
 "repository": {
   "type": "git",
   "url": "git+https://github.com/Shopify/shopify-app-node.git"
 },
 "author": "Shopify Inc.",
 "license": "MIT",
 "bugs": {
   "url": "https://github.com/shopify/shopify-app-node/issues"
 },
 "dependencies": {
   "@apollo/client": "^3.3.21",
   "@babel/core": "7.12.10",
   "@babel/polyfill": "^7.6.0",
   "@babel/preset-env": "^7.12.11",
   "@babel/register": "^7.12.10",
   "@shopify/app-bridge-react": "^2.0.2",
   "@shopify/app-bridge-utils": "^2.0.2",
   "@shopify/koa-shopify-auth": "^4.1.2",
   "@shopify/polaris": "^6.2.0",
   "apollo-boost": "^0.4.9",
   "cross-env": "^7.0.3",
   "dotenv": "^8.2.0",
   "es-abstract": "^1.17.0",
   "graphql": "^14.7.0",
   "isomorphic-fetch": "^3.0.0",
   "koa": "^2.13.1",
   "koa-router": "^10.0.0",
   "koa-session": "^6.1.0",
   "next": "^10.0.4",
   "next-env": "^1.1.0",
   "node-fetch": "^2.6.1",
   "react": "^16.10.1",
   "react-apollo": "^3.1.3",
   "react-dom": "^16.10.1",
   "webpack": "^4.44.1"
 },
 "devDependencies": {
   "@babel/plugin-transform-runtime": "^7.12.10",
   "@babel/preset-stage-3": "^7.0.0",
   "babel-jest": "26.6.3",
   "babel-register": "^6.26.0",
   "enzyme": "3.11.0",
   "enzyme-adapter-react-16": "1.15.5",
   "husky": "^4.3.6",
   "jest": "26.6.3",
   "lint-staged": "^10.5.3",
   "nodemon": "^2.0.0",
   "prettier": "2.2.1",
   "react-addons-test-utils": "15.6.2",
   "react-test-renderer": "16.14.0"
 },
 "husky": {
   "hooks": {
     "pre-commit": "lint-staged"
   }
 },
 "lint-staged": {
   "*.{js,css,json,md}": [
     "prettier --write"
   ]
 }
}```

Solution

  • I solved this issue by adding npm version in package.json like so

      "engines": {
        "node": "12.22.x",
        "npm": "7.23.x"
      },