简体   繁体   中英

Error pushing nodejs application to heroku

I am trying to deploy a nodejs site on heroku. The site runs fine with heroku local, but when I try to push to heroku remote I get the error blow. Can you please help me out?

remote: /tmp/build_75e4a69a5c93328a55b43b1f2ca7ee85/.heroku/node/lib/node_modules/npm/bin/npm-cli.js:79
remote:       var notifier = require('update-notifier')({pkg})
remote:                                                     ^
remote: SyntaxError: Unexpected token }
remote:     at Module._compile (module.js:439:25)
remote:     at Object.Module._extensions..js (module.js:474:10)
remote:     at Module.load (module.js:356:32)
remote:     at Function.Module._load (module.js:312:12)
remote:     at Function.Module.runMain (module.js:497:10)
remote:     at startup (node.js:119:16)
remote:     at node.js:945:3

If anyone else lands here, matching the node versions worked for me. In your package.json file, make sure your current node version matches with the engines section:

{
  "name": "myapp",
  "description": "a really cool app",
  "version": "1.0.0",
  "engines": {
    "node": "12.x"
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM