2

I am following the steps as mentioned in https://blog.heroku.com/deploying-react-with-zero-configuration and am able to create the project. But when I try to push the project, it gives me fsevents error. Its a completely fresh project.

  1. I have added node_modules in .gitignore
  2. I have tried npm i -f as given in https://github.com/angular/angular/issues/13935
  3. I have tried adding fsevents to optionalDependencies as said in https://github.com/angular/angular-cli/issues/8551

Non of these have helped me. The error I get :

Building dependencies
remote:        Installing node modules (package.json + package-lock)
remote:        npm ERR! code EBADPLATFORM
remote:        npm ERR! notsup Unsupported platform for fsevents@1.1.3:     wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
remote:        npm ERR! notsup Valid OS:    darwin
remote:        npm ERR! notsup Valid Arch:  any
remote:        npm ERR! notsup Actual OS:   linux
remote:        npm ERR! notsup Actual Arch: x64
remote:        
remote:        npm ERR! A complete log of this run can be found in:
remote:        npm ERR!     /tmp/npmcache.y1nYC/_logs/2018-04-09T15_10_24_227Z-debug.log
remote: 
remote: -----> Build failed

My package.json is as follows

{
  "name": "my_site",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.3.1",
    "react-dom": "^16.3.1",
    "react-scripts": "1.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}
Nischit Pradhan
  • 440
  • 6
  • 18

3 Answers3

3

My build was successfull after adding the following scripts in package.json file.

"scripts": {
    ...
    "heroku-prebuild": "npm i -f",
    "heroku-postbuild": "npm run build"
}
Elmatsidis Paul
  • 385
  • 1
  • 7
  • 19
3

Deleting the package-lock.json file in the react/client folder worked for me. I think the package-lock.json contains system-specific settings and the same settings don't work on the Heroku server.

calvh
  • 336
  • 2
  • 6
0

Updating my packages to react 16.5 resolved this for me (ran npm update and committed changes)

tcmoore
  • 1,129
  • 1
  • 12
  • 29