Search code examples
node.jsherokunpmpackage.json

How can i deploy this project on heroku?


i'm new with node, i have to deploy my first application.

this is my package.json:

  {
  "name": "tbcw",
  "description": "TheBestCollectors",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "dev": "cross-env NODE_ENV=development webpack-dev-server",
    "build": "cross-env NODE_ENV=production webpack --progress --hide-modules",
    "truffle-compile": "truffle compile",
    "truffle-serve": "truffle serve",
    "truffle-test": "truffle test --network test"
  },
  "dependencies": {
    "vue": "^2.4.4",
    "vue-draggable-resizable": "^1.5.1",
    "vuex": "^2.4.1",
    "web3": "^1.2.11"
  },
  "devDependencies": {
    "babel-core": "^6.26.3",
    "babel-loader": "^6.0.0",
    "babel-preset-env": "^1.7.0",
    "cross-env": "^3.0.0",
    "css-loader": "^0.25.0",
    "ejs": "^2.5.7",
    "ejs-compiled-loader": "^2.2.0",
    "eslint": "^4.8.0",
    "ethereumjs-testrpc": "^4.1.3",
    "file-loader": "^0.9.0",
    "html-webpack-plugin": "^2.30.1",
    "json-loader": "^0.5.7",
    "node-sass": "^4.9.4",
    "null-loader": "^0.1.1",
    "sass-loader": "^5.0.1",
    "truffle": "^3.4.11",
    "truffle-contract": "^1.1.6",
    "vue-loader": "^12.1.0",
    "vue-template-compiler": "^2.4.4",
    "webpack": "^2.6.1",
    "webpack-dev-server": "^2.9.1"
  }
}

in local with dev mode everything works correctly.

Now I would like to publish my app on heroku.

after uploading the files with herokuCLI, when i run the app, I get an error page.

reading them via the command "heroku logs --tail"

based on different attempts i got different errors, like webpack not found, start script not found, cross-env not found...

how can i proceed? Please let me know if you need more info.

thank you for all the replies


Solution

  • Looking at your package.json, it seems your are working on a client-side application. Such applications run in the client's browser, rather than in Node. Heroku is for running server-side applications, so it's probably not the right place to deploy your app.

    Take a look at something like Vercel or Netlify instead. They provide tools to automatically build and deploy client-side applications to edge networks with only a few clicks.