django-react-boilerplate icon indicating copy to clipboard operation
django-react-boilerplate copied to clipboard

Bug; Error Deploying to Heroku During Installing dependencies error arises

Open ArchTaqi opened this issue 3 years ago • 1 comments

Describe the bug

Just Fork the Repo and Try to Deploy on Heroku and having build faiiled ad node packages installation process.

To Reproduce Steps to reproduce the behavior:

  1. Fork the repo.
  2. Input information into the Heroku deployment form
  3. During Installing dependencies error arises.

Expected behavior

Should be deployed cleanly.

Screenshots

remote:        Successfully installed amqp-5.0.9 asgiref-3.5.0 asttokens-2.0.5 backcall-0.2.0 billiard-3.6.4.0 black-22.1.0 brotlipy-0.7.0 celery-5.2.3 celery-redbeat-2.0.0 certifi-2021.10.8 cffi-1.15.0 click-8.0.4 click-didyoumean-0.3.0 click-plugins-1.1.1 click-repl-0.2.0 decorator-5.1.1 defusedxml-0.7.1 deprecated-1.2.13 diff-match-patch-20200713 dj-database-url-0.5.0 django-3.2.12 django-debreach-2.1.0 django-import-export-2.7.1 django-js-reverse-0.9.1 django-log-request-id-2.0.0 django-model-utils-4.2.0 django-webpack-loader-1.4.1 djangorestframework-3.13.1 et-xmlfile-1.1.0 executing-0.8.2 gunicorn-20.1.0 ipython-8.0.1 jedi-0.18.1 kombu-5.2.3 markuppy-1.14 matplotlib-inline-0.1.3 mypy-extensions-0.4.3 odfpy-1.4.1 openpyxl-3.0.9 packaging-21.3 parso-0.8.3 pathspec-0.9.0 pexpect-4.8.0 pickleshare-0.7.5 platformdirs-2.5.1 prompt-toolkit-3.0.28 psutil-5.9.0 psycopg2-2.9.3 ptyprocess-0.7.0 pure-eval-0.2.2 pycparser-2.21 pygments-2.11.2 pyparsing-3.0.7 python-dateutil-2.8.2 python-decouple-3.6 pytz-2021.3 pyyaml-6.0 redis-4.1.4 sentry-sdk-1.5.6 setuptools-59.6.0 six-1.16.0 sqlparse-0.4.2 stack-data-0.2.0 tablib-3.2.0 tenacity-8.0.1 tomli-2.0.1 traitlets-5.1.1 typing-extensions-4.1.1 urllib3-1.26.8 vine-5.0.0 wcwidth-0.2.5 whitenoise-6.0.0 wrapt-1.13.3 xlrd-2.0.1 xlwt-1.3.0
remote: -----> Skipping Django collectstatic since the env var DISABLE_COLLECTSTATIC is set.
remote: -----> Running post-compile hook
remote: -----> Post-compile hook
remote: -----> Running manage.py check --deploy --fail-level WARNING
remote: System check identified no issues (0 silenced).
remote: -----> Pushing source maps to Sentry
remote: -----> Post-compile done
remote: -----> Node.js app detected
remote:        
remote: -----> Creating runtime environment
remote:        
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_VERBOSE=false
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:        
remote: -----> Installing binaries
remote:        engines.node (package.json):  16.x
remote:        engines.npm (package.json):   unspecified (use default)
remote:        
remote:        Resolving node version 16.x...
remote:        Downloading and installing node 16.14.0...
remote:        Using default npm version: 8.3.1
remote:        
remote: -----> Installing dependencies
remote:        Installing node modules (package.json)
remote:        npm ERR! code 1
remote:        npm ERR! path /tmp/build_9a55361e/node_modules/node-sass
remote:        npm ERR! command failed
remote:        npm ERR! command sh -c node scripts/build.js
remote:        npm ERR! Building: /tmp/build_9a55361e/.heroku/node/bin/node /tmp/build_9a55361e/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
remote:        npm ERR! gyp info it worked if it ends with ok
remote:        npm ERR! gyp verb cli [
remote:        npm ERR! gyp verb cli   '/tmp/build_9a55361e/.heroku/node/bin/node',
remote:        npm ERR! gyp verb cli   '/tmp/build_9a55361e/node_modules/node-gyp/bin/node-gyp.js',
remote:        npm ERR! gyp verb cli   'rebuild',
remote:        npm ERR! gyp verb cli   '--verbose',
remote:        npm ERR! gyp verb cli   '--libsass_ext=',
remote:        npm ERR! gyp verb cli   '--libsass_cflags=',
remote:        npm ERR! gyp verb cli   '--libsass_ldflags=',
remote:        npm ERR! gyp verb cli   '--libsass_library='
remote:        npm ERR! gyp verb cli ]
remote:        npm ERR! gyp info using [email protected]
remote:        npm ERR! gyp info using [email protected] | linux | x64
remote:        npm ERR! gyp verb command rebuild []
remote:        npm ERR! gyp verb command clean []
remote:        npm ERR! gyp verb clean removing "build" directory
remote:        npm ERR! gyp verb command configure []
remote:        npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
remote:        npm ERR! gyp verb `which` succeeded python2 /usr/bin/python2
remote:        npm ERR! gyp ERR! configure error 
remote:        npm ERR! gyp ERR! stack Error: Command failed: /usr/bin/python2 -c import sys; print "%s.%s.%s" % sys.version_info[:3];
remote:        npm ERR! gyp ERR! stack ImportError: No module named site
remote:        npm ERR! gyp ERR! stack 
remote:        npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:399:12)
remote:        npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
remote:        npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1092:16)
remote:        npm ERR! gyp ERR! stack     at Socket.<anonymous> (node:internal/child_process:451:11)
remote:        npm ERR! gyp ERR! stack     at Socket.emit (node:events:520:28)
remote:        npm ERR! gyp ERR! stack     at Pipe.<anonymous> (node:net:687:12)
remote:        npm ERR! gyp ERR! System Linux 4.4.0-1098-aws
remote:        npm ERR! gyp ERR! command "/tmp/build_9a55361e/.heroku/node/bin/node" "/tmp/build_9a55361e/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
remote:        npm ERR! gyp ERR! cwd /tmp/build_9a55361e/node_modules/node-sass
remote:        npm ERR! gyp ERR! node -v v16.14.0
remote:        npm ERR! gyp ERR! node-gyp -v v3.8.0
remote:        npm ERR! gyp ERR! not ok 
remote:        npm ERR! Build failed with error code: 1
remote:        
remote:        npm ERR! A complete log of this run can be found in:
remote:        npm ERR!     /tmp/npmcache.IUavf/_logs/2022-02-24T13_33_04_571Z-debug-0.log
remote: 
remote: -----> Build failed

ArchTaqi avatar Feb 24 '22 13:02 ArchTaqi

I had a similar issue when attempting to deploy to Heroku. I was able to successfully deploy the app by downgrading my node version from 16.x to 15.x

You can do this by specifying the node engine in your package.json file:

{
  "name": "projectname-frontend",
  ...
  "engines": {
    "node": "12.x"
  },
  ...
}

mark-florian avatar May 11 '22 01:05 mark-florian

Hey, folks. In a recent update, we've explicitly added the engine in the package.json, but we also stop supporting the integration with Heroku, since it doesn't have a free plan anymore. We have instructions on how to integrate with Render.com instead now.

hugobessa avatar Jun 30 '23 13:06 hugobessa