jaredpalmer / razzle

✨ Create server-rendered universal JavaScript applications with no configuration

Home Page:https://razzlejs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't deploy to heroku

rcrcr-omni opened this issue · comments

❓Question

I cannot get heroku to pass my build using razzle. I've installed razzle-heroku. I've shifted to yarn. I have a yarn.lock file in both root and my app folder.
My project has a node server and a razzle/react client/server combo.

./package.json

{
  "name": "charlierowat.com",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node server/index.js",
    "dev": "nodemon server/index.js",
    "heroku-postbuild": "cd app && yarn install && yarn build"
  },
  "proxy": "localhost:3001",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/rcrcr-omni/charlesrowat.co.uk.git"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/rcrcr-omni/charlesrowat.co.uk/issues"
  },
  "homepage": "https://github.com/rcrcr-omni/charlesrowat.co.uk#readme",
  "dependencies": {
    "@babel/plugin-proposal-class-properties": "^7.18.6",
    "@babel/preset-env": "^7.20.2",
    "@babel/preset-react": "^7.18.6",
    "@tanstack/react-query": "^4.19.1",
    "@ungap/structured-clone": "^1.0.1",
    "aws-sdk": "^2.1275.0",
    "axios": "^1.1.3",
    "babel-plugin-transform-assets": "^1.0.2",
    "cors": "^2.8.5",
    "create-razzle-app": "^4.2.18",
    "dotenv": "^16.0.3",
    "express": "^4.18.2",
    "google-spreadsheet": "^3.3.0",
    "ignore-styles": "^5.0.1",
    "nodemon": "^2.0.20",
    "react-dom": "^18.2.0",
    "react-router-dom": "^6.6.1",
    "serialize-javascript": "^6.0.0",
    "sitemap": "^7.1.1"
  },
  "devDependencies": {
    "@babel/register": "^7.18.9"
  }
}

/app/package.json

{
  "name": "charlierowat.com",
  "version": "1.0.1",
  "license": "MIT",
  "proxy": "localhost:3000",
  "scripts": {
    "start": "razzle start",
    "build": "razzle build",
    "export": "razzle export",
    "test": "razzle test --env=jsdom",
    "start:static": "serve -s build/public",
    "start:prod": "NODE_ENV=production node build/server.js"
  },
  "dependencies": {
    "express": "^4.17.1",
    "razzle-heroku": "^3.0.0",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-ga4": "^1.4.1",
    "react-helmet": "^6.1.0",
    "react-markdown": "^6.0.3",
    "react-router-dom": "^5.1.2"
  },
  "devDependencies": {
    "babel-preset-razzle": "4.2.15",
    "html-webpack-plugin": "^4.5.2",
    "mini-css-extract-plugin": "^0.9.0",
    "razzle": "4.2.15",
    "razzle-dev-utils": "4.2.15",
    "serve": "^11.3.2",
    "webpack": "^4.44.1",
    "webpack-dev-server": "^3.11.2"
  }
}

Error (from heroku-postbuild)

remote: -----> Build
remote:        Running heroku-postbuild (yarn)
remote:        yarn run v1.22.19
remote:        $ cd app && yarn install && yarn build
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        [3/4] Linking dependencies...
remote: warning " > react-markdown@6.0.3" has unmet peer dependency "@types/react@>=16".
remote: warning "razzle > babel-jest@26.6.3" has unmet peer dependency "@babel/core@^7.0.0".
remote: warning "razzle > babel-loader@8.3.0" has unmet peer dependency "@babel/core@^7.0.0".
remote: warning "razzle > babel-jest > babel-preset-jest@26.6.2" has unmet peer dependency "@babel/core@^7.0.0".
remote: warning "razzle > babel-jest > babel-preset-jest > babel-preset-current-node-syntax@1.0.1" has unmet peer dependency "@babel/core@^7.0.0".
remote: warning "razzle > babel-jest > babel-preset-jest > babel-preset-current-node-syntax > @babel/plugin-syntax-import-meta@7.10.4" has unmet peer dependency "@babel/core@^7.0.0-0".
remote:        [4/4] Building fresh packages...
remote:        $ razzle build
remote: /bin/sh: 1: razzle: not found
remote: error Command failed with exit code 127.
remote:        info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
remote: error Command failed with exit code 127.
remote:        info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
remote: 
remote: -----> Build failed
remote:        
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:        
remote:        Some possible problems:
remote:        
remote:        - node_modules checked into source control
remote:          https://devcenter.heroku.com/articles/node-best-practices#only-git-the-important-bits
remote:        
remote:        - Node version not specified in package.json
remote:          https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
remote:        
remote:        Love,
remote:        Heroku
remote:        
remote:  !     Push rejected, failed to compile Node.js app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !	Push rejected to charliepersonalwebsite.

I would appreciate any help as razzle is the only way I've managed to get server side rendering working. Locally, at least!