- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在尝试通过 Heroku 部署我的应用程序,它在本地主机上运行良好。尽管我在本地主机上安装 java 模块时遇到了一些麻烦,但我终于做到了,感谢这篇文章:https://github.com/nodejs/node/issues/10289 .
现在,我在 Heroku 上部署应用程序时显然遇到了同样的错误,但现在我无法修复它。我什至设置了 Java Buildpack,以防万一,但它没有帮助。
我希望有人能帮助我!
这是我的 package.json:
{
"name": "tachology",
"version": "0.0.0",
"main": "server/index.js",
"dependencies": {
"angular": "~1.6.0",
"angular-animate": "~1.6.0",
"angular-aria": "~1.6.0",
"angular-cookies": "~1.6.0",
"angular-resource": "~1.6.0",
"angular-sanitize": "~1.6.0",
"angular-ui-router": "^0.4.2",
"angular-validation-match": "^1.9.0",
"babel-polyfill": "^6.7.2",
"babel-runtime": "^6.6.1",
"bluebird": "^3.3.3",
"body-parser": "^1.13.3",
"cal-heatmap": "^3.6.2",
"composable-middleware": "^0.3.0",
"connect-mongo": "^1.2.1",
"cookie-parser": "^1.3.5",
"core-js": "^2.2.1",
"errorhandler": "^1.4.2",
"express": "^4.13.3",
"express-jwt": "^5.0.0",
"express-session": "^1.11.3",
"fast-json-patch": "^1.0.0",
"font-awesome": ">=4.1.0",
"gridfs": "^1.0.0",
"java": "^0.8.0",
"jquery": "^3.2.1",
"jsonformatter": "^0.6.0",
"jsonwebtoken": "^7.0.0",
"lodash": "^4.6.1",
"lusca": "^1.3.0",
"method-override": "^2.3.5",
"mongoose": "^4.1.2",
"morgan": "~1.7.0",
"multer": "^1.3.0",
"multer-gridfs-storage": "^1.2.2",
"ng-google-charts": "^0.1.3",
"passport": "~0.3.0",
"passport-local": "^1.0.0",
"pug": "2.0.0-beta4",
"serve-favicon": "^2.3.0",
"shrink-ray": "^0.1.3",
"sprint-js": "~0.1.0",
"uikit": "^3.0.0-beta.24"
},
"devDependencies": {
"angular-mocks": "~1.6.0",
"autoprefixer": "^6.0.0",
"babel-core": "^6.6.5",
"babel-eslint": "^6.0.4",
"babel-register": "^6.6.5",
"browser-sync": "^2.8.0",
"bs-fullscreen-message": "^1.0.0",
"babel-plugin-transform-class-properties": "^6.6.0",
"babel-plugin-transform-runtime": "^6.6.0",
"babel-preset-es2015": "^6.6.0",
"eslint": "^2.12.0",
"del": "^2.0.2",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-env": "^0.4.0",
"gulp-eslint": "^2.0.0",
"gulp-imagemin": "^3.0.1",
"gulp-inject": "^4.0.0",
"gulp-istanbul": "^1.1.1",
"gulp-istanbul-enforcer": "^1.0.3",
"gulp-load-plugins": "^1.0.0-rc.1",
"gulp-mocha": "^2.1.3",
"gulp-node-inspector": "^0.1.0",
"gulp-plumber": "^1.0.1",
"gulp-protractor": "^3.0.0",
"gulp-rev": "^7.0.0",
"gulp-rev-replace": "^0.4.2",
"gulp-sort": "^2.0.0",
"gulp-sourcemaps": "^1.5.2",
"gulp-util": "^3.0.5",
"gulp-watch": "^4.3.5",
"gulp-stylint": "^3.0.0",
"grunt": "^1.0.1",
"grunt-build-control": "^0.7.0",
"isparta": "^4.0.0",
"nodemon": "^1.3.7",
"run-sequence": "^1.1.0",
"lazypipe": "^1.0.1",
"webpack": "^1.12.14",
"webpack-dev-middleware": "^1.5.1",
"webpack-stream": "^3.2.0",
"extract-text-webpack-plugin": "^1.0.1",
"html-webpack-plugin": "^2.16.0",
"html-webpack-harddisk-plugin": "~0.0.2",
"pug-html-loader": "^1.0.8",
"awesome-typescript-loader": "0.17.0",
"ng-annotate-loader": "~0.1.0",
"babel-loader": "^6.2.4",
"css-loader": "^0.24.0",
"file-loader": "^0.9.0",
"imports-loader": "^0.6.5",
"isparta-instrumenter-loader": "^1.0.0",
"isparta-loader": "^2.0.0",
"istanbul-instrumenter-loader": "^0.2.0",
"null-loader": "^0.1.1",
"postcss-loader": "^0.11.1",
"raw-loader": "^0.5.1",
"style-loader": "^0.13.0",
"node-sass": "^3.8.0",
"sass-loader": "^4.0.1",
"karma-webpack": "^1.7.0",
"through2": "^2.0.1",
"open": "~0.0.4",
"istanbul": "1.1.0-alpha.1",
"chai": "^3.2.0",
"sinon": "^1.16.1",
"chai-as-promised": "^5.1.0",
"chai-things": "^0.2.0",
"karma": "~0.13.3",
"karma-firefox-launcher": "^1.0.0",
"karma-script-launcher": "^1.0.0",
"karma-coverage": "^1.0.0",
"karma-chrome-launcher": "^2.0.0",
"karma-phantomjs-launcher": "~1.0.0",
"karma-spec-reporter": "~0.0.20",
"karma-sourcemap-loader": "~0.3.7",
"sinon-chai": "^2.8.0",
"mocha": "^3.0.2",
"jasmine-core": "^2.3.4",
"karma-jasmine": "^1.0.2",
"jasmine-spec-reporter": "^2.4.0",
"phantomjs-prebuilt": "^2.1.4",
"proxyquire": "^1.0.1",
"strip-ansi": "^3.0.1",
"supertest": "^1.1.0"
},
"engines": {
"node": "6.2.2",
"npm": "3.9.5"
},
"scripts": {
"test": "gulp test",
"update-webdriver": "node node_modules/protractor/bin/webdriver-manager update",
"start": "node server"
},
"private": true
}
这是部署时的日志:
Warning: remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NPM_CONFIG_PRODUCTION=true
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 6.2.2
remote: engines.npm (package.json): 3.9.5
remote:
remote: Resolving node version 6.2.2...
remote: Downloading and installing node 6.2.2...
remote: npm 3.9.5 already installed with node
remote:
remote: -----> Restoring cache
remote: Skipping cache restore (new-signature)
remote:
remote: -----> Building dependencies
remote: Installing node modules (package.json)
remote:
remote: > iltorb@1.3.6 install /tmp/build_2beaa787f71f40bc41e528a14b9c399c/node_modules/iltorb
remote: > node-pre-gyp install --fallback-to-build
remote:
remote: [iltorb] Success: "/tmp/build_2beaa787f71f40bc41e528a14b9c399c/node_modules/iltorb/build/bindings/iltorb.node" is installed via remote
remote:
remote: > node-zopfli@1.4.0 install /tmp/build_2beaa787f71f40bc41e528a14b9c399c/node_modules/node-zopfli
remote: > node-pre-gyp install --fallback-to-build
remote:
remote: node-pre-gyp ERR! Tried to download(403): https://node-zopfli.s3.amazonaws.com/Release/zopfli-v1.4.0-node-v48-linux-x64.tar.gz
remote: node-pre-gyp ERR! Pre-built binaries not found for node-zopfli@1.4.0 and node@6.2.2 (node-v48 ABI) (falling back to source compile with node-gyp)
remote: make: Entering directory '/tmp/build_2beaa787f71f40bc41e528a14b9c399c/node_modules/node-zopfli/build'
remote: CXX(target) Release/obj.target/zopfli/src/zopfli-binding.o
remote: CXX(target) Release/obj.target/zopfli/src/png/zopflipng.o
remote: CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/blocksplitter.o
remote: CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/cache.o
remote: CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/deflate.o
remote: CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/gzip_container.o
remote: CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/hash.o
remote: CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/katajainen.o
remote: CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/lz77.o
remote: CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/squeeze.o
remote: CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/tree.o
remote: CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/util.o
remote: CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/zlib_container.o
remote: CC(target) Release/obj.target/zopfli/zopfli/src/zopfli/zopfli_lib.o
remote: CXX(target) Release/obj.target/zopfli/zopfli/src/zopflipng/zopflipng_lib.o
remote: CXX(target) Release/obj.target/zopfli/zopfli/src/zopflipng/lodepng/lodepng.o
remote: CXX(target) Release/obj.target/zopfli/zopfli/src/zopflipng/lodepng/lodepng_util.o
remote: SOLINK_MODULE(target) Release/obj.target/zopfli.node
remote: COPY Release/zopfli.node
remote: COPY /tmp/build_2beaa787f71f40bc41e528a14b9c399c/node_modules/node-zopfli/lib/binding/node-v48-linux-x64/zopfli.node
remote: TOUCH Release/obj.target/action_after_build.stamp
remote: make: Leaving directory '/tmp/build_2beaa787f71f40bc41e528a14b9c399c/node_modules/node-zopfli/build'
remote:
remote: > java@0.8.0 install /tmp/build_2beaa787f71f40bc41e528a14b9c399c/node_modules/java
remote: > node-gyp rebuild
remote:
remote: [node-java] Error: not found: javac
remote: gyp: Call to 'node findJavaHome.js' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
remote: gyp ERR! configure error
remote: gyp ERR! stack Error: `gyp` failed with exit code: 1
remote: gyp ERR! stack at ChildProcess.onCpExit (/tmp/build_2beaa787f71f40bc41e528a14b9c399c/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
remote: gyp ERR! stack at emitTwo (events.js:106:13)
remote: gyp ERR! stack at ChildProcess.emit (events.js:191:7)
remote: gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
remote: gyp ERR! System Linux 3.13.0-128-generic
remote: gyp ERR! command "/tmp/build_2beaa787f71f40bc41e528a14b9c399c/.heroku/node/bin/node" "/tmp/build_2beaa787f71f40bc41e528a14b9c399c/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
remote: gyp ERR! cwd /tmp/build_2beaa787f71f40bc41e528a14b9c399c/node_modules/java
remote: gyp ERR! node -v v6.2.2
remote: gyp ERR! node-gyp -v v3.3.1
remote: gyp ERR! not ok
remote: tachology@0.0.0 /tmp/build_2beaa787f71f40bc41e528a14b9c399c
remote: ├── angular@1.6.6
remote: ...
remote: ├── sprint-js@0.1.0
remote: └── uikit@3.0.0-beta.30
remote:
remote: npm ERR! Linux 3.13.0-128-generic
remote: npm ERR! argv "/tmp/build_2beaa787f71f40bc41e528a14b9c399c/.heroku/node/bin/node" "/tmp/build_2beaa787f71f40bc41e528a14b9c399c/.heroku/node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/build_2beaa787f71f40bc41e528a14b9c399c/.npmrc"
remote: npm ERR! node v6.2.2
remote: npm ERR! npm v3.9.5
remote: npm ERR! code ELIFECYCLE
remote:
remote: npm ERR! java@0.8.0 install: `node-gyp rebuild`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the java@0.8.0 install script 'node-gyp rebuild'.
remote: npm ERR! Make sure you have the latest version of node.js and npm installed.
remote: npm ERR! If you do, this is most likely a problem with the java package,
remote: npm ERR! not with npm itself.
remote: npm ERR! Tell the author that this fails on your system:
remote: npm ERR! node-gyp rebuild
remote: npm ERR! You can get information on how to open an issue for this project with:
remote: npm ERR! npm bugs java
remote: npm ERR! Or if that isn't available, you can get their info via:
remote: npm ERR! npm owner ls java
remote: npm ERR! There is likely additional logging output above.
remote:
remote: npm ERR! Please include the following file with any support request:
remote: npm ERR! /tmp/build_2beaa787f71f40bc41e528a14b9c399c/npm-debug.log
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: If you're stuck, please submit a ticket so we can help:
remote: https://help.heroku.com/
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 tachology.
remote:
To https://git.heroku.com/tachology.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/tachology.git'
Use --force to continue.
Aborted due to warnings.
最佳答案
看来您的 node-gyp 需要正确构建 java。 Heroku 架构的问题在于它只提供您指定/需要的内容。现在我认为 Heroku 不明白它需要一个 JVM 来运行你的应用程序。所以你应该提供一个buildpack。简单地说,构建包是一组规则,告诉 Heroku 要设置、安装和构建什么。有一个名为 heroku/jvm
的 JVM 构建包。因此,您需要做的是通过仪表板或 CLI 通过 heroku buildpacks:add heroku/jvm
将其添加到您的应用程序。
还有一件事要做。由于您的应用程序本身在构建时需要 javac,因此我们应该提取 java/jvm 的构建顺序。所以在这种情况下,您可能应该执行 heroku buildpacks:add --index 1 heroku/jvm
。这会将 JVM buildpack 放在位置 1 并将所有其他 buildpack 推下顺序。
现在,当应用程序开始构建时,它首先设置 JVM(从而为您的实例启用 javac),然后运行 NodeJS 构建。此构建现在将从当前实例中获取 javac 并进行相应构建。
关于java - 使用 Heroku (npm java) 部署失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46182354/
我在使用以下代码时遇到问题: function http_file_exists($url){ $f=fopen($url,"r"); if($f){ fclose($f); retu
我已经通过 Git 部署到 Azure 几个月了,没有出现重大问题,但现在我似乎遇到了一个无法克服的错误。 我创建了一个新的 Azure 网站,为正在开发的项目创建单独的预览链接。我在新站点上设置了
我已经通过flutter创建了一个App并完成了它,我想在flutter文档中阅读时进行部署。 我收到此错误: FAILURE: Build failed with an exception. * W
我在Windows 10中使用一些简单的Powershell代码遇到了这个奇怪的问题,我认为这可能是我做错了,但我不是Powershell的天才。 我有这个: $ix = [System.Net.Dn
我正在尝试使用 RapidJSON 解析从服务器接收到的数据。以下是收到的确切字符串: [ { "Node": "9478149a08f9", "Address": "172.17
我尝试为 ios 编译 OpenCV。我总是收到这些错误。我用不同版本的opencv试了一下,结果都是一样的。 我运行这个:python 平台/ios/build_framework.py ios_o
我在一台机器上做基本的发布/订阅,我的客户端是 StackExchange-Redis 的 C# 客户端,我在同一台机器上运行基于 Windows 的 Redis 服务器(服务器版本 2.8.4) 当
我有这段代码,但无法执行,请帮我解决这个问题 连接 connect_error) { die ("connection failed: " . $terhubung->connect_erro
我在 tomcat 上运行并由 maven 编译的 Web 应用程序给出了以下警告和错误。我可以在本地存储库中看到所有 JAR,但有人可以帮忙吗。 WARNING: Failed to scan JA
我正在 Windows 8 上使用 Android Studio 开发一个 android 应用程序,我正在使用一些 native 代码。突然间我无法编译我的 C 文件。当我运行 ndk-build
下面的代码对类和结构的成员进行序列化和反序列化。序列化工作正常,但我在尝试使用 oarch >> BOOST_SERIALIZATION_NVP(outObj); 反序列化时遇到了以下错误; 代码中是
如果我运行此命令“rspec ./spec/requests/api/v1/password_reset_request_spec.rb”,此文件中的所有测试都会通过。 但是,当我运行“rspec”时
我在尝试执行测试以使用 Protractor 上传文件时出错,我的代码是这个 it('it should be possible to upload a file', function() {
System.loadLibrary("nativefaceswap"); 当我运行我的应用程序时,我在 Android Studio 中发现了此类错误。在logcat中显示: java.lang.U
我希望有人能帮助我!使用任何方法或命令行的任何 SSL/HTTPS 调用均无效。 我在 Windows 10 中使用 Ubuntu Server 18.04 作为子系统。我的问题是昨天才开始出现的,因
通过删除这两个值将日期字段从 null=True 和 Blank=True 更改为 required 时,使用 db.alter 命令时遇到问题。 当以下行被注释掉时,迁移运行不会出现问题。
我第一次使用 Heroku 尝试创建应用程序(使用 SendGrid 的 Inbound Parse Webhook"和 Twilio SMS 通过电子邮件发送和接收 SMS 消息)。通过 Virtu
我正在将我的 swift 项目更新到 Xcode 7 上的 Swift 2.0。xcode 在构建项目时报告了以下错误: 命令/Applications/Xcode.app/Contents/Deve
在我的代码中,SSL 库函数 SSL_library_init() 没有按预期返回 1。我如何才能看到它返回了什么错误? 我在 SSL_library_init() 之后调用了 SSL_load_er
我正在尝试运行在以下链接中找到的答案: Asynchronously Load the Contents of a Div 但是当我这样做时,我会遇到我不太理解的错误。 我的代码: $(documen
我是一名优秀的程序员,十分优秀!