将Reactjs应用程序推送到Heroku,给出了fsevents错误
我遵循,并且能够创建项目。但是当我试图推动项目时,它给了我fsevents
错误。这是一个全新的项目。
- 我在
node_modules
添加了.gitignore
- 我在
npm i -f
尝试过 - 我曾尝试在
fsevents
中将optionalDependencies
添加到
没有这些帮助了我。我得到的错误:
Building dependencies
remote: Installing node modules (package.json + package-lock)
remote: npm ERR! code EBADPLATFORM
remote: npm ERR! notsup Unsupported platform for [email protected]: 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
我的package.json
如下
{
"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"
}
}
回答如下:
在package.json文件中添加以下脚本后,我的构建成功。
"scripts": {
...
"heroku-prebuild": "npm i -f",
"heroku-postbuild": "npm run build"
}
将Reactjs应用程序推送到Heroku,给出了fsevents错误
我遵循,并且能够创建项目。但是当我试图推动项目时,它给了我fsevents
错误。这是一个全新的项目。
- 我在
node_modules
添加了.gitignore
- 我在
npm i -f
尝试过 - 我曾尝试在
fsevents
中将optionalDependencies
添加到
没有这些帮助了我。我得到的错误:
Building dependencies
remote: Installing node modules (package.json + package-lock)
remote: npm ERR! code EBADPLATFORM
remote: npm ERR! notsup Unsupported platform for [email protected]: 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
我的package.json
如下
{
"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"
}
}
回答如下:
在package.json文件中添加以下脚本后,我的构建成功。
"scripts": {
...
"heroku-prebuild": "npm i -f",
"heroku-postbuild": "npm run build"
}