質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

Q&A

2回答

1067閲覧

Herokuへデプロイをしたいがエラーになる

yuki1083kk

総合スコア0

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Node.js

Node.jsとはGoogleのV8 JavaScriptエンジンを使用しているサーバーサイドのイベント駆動型プログラムです。

0グッド

0クリップ

投稿2023/04/10 06:12

実現したいこと

ここに実現したいことを箇条書きで書いてください。
Herokuにデプロイしたい。

前提

ここに質問の内容を詳しく書いてください。
(例)
Heroku 18の更新の締め切りが4月末までなので、サイトで更新設定して次回デプロイしたら更新されますと書いてあったので、デプロイしたくてgit push heroku mainを入れたら何度もエラーになったので自分で色々検索したりnodeやnmpなどの設定したりしてみました。それでもエラーになったから強制的に上書きするgit push heroku main -fというコードが書いてあるサイトを見つけてやってみたのですがエラーになってしまい先に進めません。

発生している問題・エラーメッセージ

Enumerating objects: 131, done. Counting objects: 100% (131/131), done. Delta compression using up to 8 threads Compressing objects: 100% (107/107), done. Writing objects: 100% (131/131), 163.38 KiB | 81.69 MiB/s, done. Total 131 (delta 8), reused 131 (delta 8), pack-reused 0 remote: Resolving deltas: 100% (8/8), done. remote: Updated 105 paths from 3ff227d remote: Compressing source files... done. remote: Building source: remote: remote: -----> Building on the Heroku-22 stack remote: -----> Using buildpacks: remote: 1. heroku/nodejs remote: 2. heroku/ruby remote: -----> Node.js app detected remote: remote: -----> Creating runtime environment remote: remote: NPM_CONFIG_LOGLEVEL=error remote: USE_YARN_CACHE=true remote: NODE_VERBOSE=false remote: NODE_ENV=production remote: NODE_MODULES_CACHE=true remote: remote: -----> Installing binaries remote: engines.node (package.json): unspecified remote: engines.npm (package.json): unspecified (use default) remote: engines.yarn (package.json): unspecified (use default) remote: remote: Resolving node version 18.x... remote: Downloading and installing node 18.15.0... remote: Using default npm version: 9.5.0 remote: Resolving yarn version 1.22.x... remote: Downloading and installing yarn (1.22.19) remote: Installed yarn 1.22.19 remote: remote: -----> Restoring cache remote: Cached directories were not restored due to a change in version of node, npm, yarn or stack remote: Module installation may take longer for this build remote: remote: -----> Installing dependencies remote: Installing node modules (yarn.lock) remote: yarn install v1.22.19 remote: [1/4] Resolving packages... remote: [2/4] Fetching packages... remote: [3/4] Linking dependencies... remote: warning " > webpack-dev-server@4.7.4" has unmet peer dependency "webpack@^4.37.0 || ^5.0.0". remote: warning "webpack-dev-server > webpack-dev-middleware@5.3.1" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0". remote: [4/4] Building fresh packages... remote: error /tmp/build_cc3791e1/node_modules/node-sass: Command failed remote: Exit code: 1 remote: Command: node scripts/build.js remote: Arguments: remote: Directory: /tmp/build_cc3791e1/node_modules/node-sass remote: Output: remote: Building: /tmp/build_cc3791e1/.heroku/node/bin/node /tmp/build_cc3791e1/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= remote: gyp info it worked if it ends with ok remote: gyp verb cli [ remote: gyp verb cli '/tmp/build_cc3791e1/.heroku/node/bin/node', remote: gyp verb cli '/tmp/build_cc3791e1/node_modules/node-gyp/bin/node-gyp.js', remote: gyp verb cli 'rebuild', remote: gyp verb cli '--verbose', remote: gyp verb cli '--libsass_ext=', remote: gyp verb cli '--libsass_cflags=', remote: gyp verb cli '--libsass_ldflags=', remote: gyp verb cli '--libsass_library=' remote: gyp verb cli ] remote: gyp info using node-gyp@3.8.0 remote: gyp info using node@18.15.0 | linux | x64 remote: gyp verb command rebuild [] remote: gyp verb command clean [] remote: gyp verb clean removing "build" directory remote: gyp verb command configure [] remote: gyp verb check python checking for Python executable "python2" in the PATH remote: gyp verb `which` failed Error: not found: python2 remote: gyp verb `which` failed at getNotFoundError (/tmp/build_cc3791e1/node_modules/which/which.js:13:12) remote: gyp verb `which` failed at F (/tmp/build_cc3791e1/node_modules/which/which.js:68:19) remote: gyp verb `which` failed at E (/tmp/build_cc3791e1/node_modules/which/which.js:80:29) remote: gyp verb `which` failed at /tmp/build_cc3791e1/node_modules/which/which.js:89:16 remote: gyp verb `which` failed at /tmp/build_cc3791e1/node_modules/isexe/index.js:42:5 remote: gyp verb `which` failed at /tmp/build_cc3791e1/node_modules/isexe/mode.js:8:5 remote: gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:208:21) remote: gyp verb `which` failed python2 Error: not found: python2 remote: gyp verb `which` failed at getNotFoundError (/tmp/build_cc3791e1/node_modules/which/which.js:13:12) remote: gyp verb `which` failed at F (/tmp/build_cc3791e1/node_modules/which/which.js:68:19) remote: gyp verb `which` failed at E (/tmp/build_cc3791e1/node_modules/which/which.js:80:29) remote: gyp verb `which` failed at /tmp/build_cc3791e1/node_modules/which/which.js:89:16 remote: gyp verb `which` failed at /tmp/build_cc3791e1/node_modules/isexe/index.js:42:5 remote: gyp verb `which` failed at /tmp/build_cc3791e1/node_modules/isexe/mode.js:8:5 remote: gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:208:21) { remote: gyp verb `which` failed code: 'ENOENT' remote: gyp verb `which` failed } remote: gyp verb check python checking for Python executable "python" in the PATH remote: gyp verb `which` succeeded python /usr/bin/python remote: gyp ERR! configure error remote: gyp ERR! stack Error: Command failed: /usr/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3]; remote: gyp ERR! stack File "<string>", line 1 remote: gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3]; remote: gyp ERR! stack ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ remote: gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)? remote: gyp ERR! stack remote: gyp ERR! stack at ChildProcess.exithandler (node:child_process:419:12) remote: gyp ERR! stack at ChildProcess.emit (node:events:513:28) remote: gyp ERR! stack at maybeClose (node:internal/child_process:1091:16) remote: gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:302:5) remote: gyp ERR! System Linux 4.4.0-1104-aws remote: gyp ERR! command "/tmp/build_cc3791e1/.heroku/node/bin/node" "/tmp/build_cc3791e1/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" remote: gyp ERR! cwd /tmp/build_cc3791e1/node_modules/node-sass remote: gyp ERR! node -v v18.15.0 remote: gyp ERR! node-gyp -v v3.8.0 remote: gyp ERR! not ok remote: Build failed with error code: 1 remote: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. 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: Some possible problems: remote: remote: - Node version not specified in package.json remote: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version remote: remote: Love, remote: Heroku remote: remote: ! Push rejected, failed to compile Node.js app. remote: remote: ! Push failed remote: ! remote: ! ## Warning - The same version of this code has already been built: d2b96547c4e5af67aa50c08a8f763d0e03373c47 remote: ! remote: ! We have detected that you have triggered a build from source code with version d2b96547c4e5af67aa50c08a8f763d0e03373c47 remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch. remote: ! remote: ! If you are developing on a branch and deploying via git you must run remote: ! remote: ! git push heroku <branchname>:main remote: ! remote: ! This article goes into details on the behavior: remote: ! https://devcenter.heroku.com/articles/duplicate-build-version remote: remote: Verifying deploy... remote: remote: ! Push rejected to ajax-app-37674. remote: To https://git.heroku.com/ajax-app-37674.git ! [remote rejected] main -> main (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/ajax-app-37674.git'

該当のソースコード

ruby

試したこと

git push heroku main -fコマンドを入れた

補足情報(FW/ツールのバージョンなど)

久しぶりすぎて忘れてしまっていて初心者的でわかりづらいまとめと質問で申し訳ありません。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

お返事遅くなり大変申し訳ございません。
お忙しい中ご返答いただきありがとうございました。
ご回答の通り、試行錯誤、四苦八苦なんとかやってみようと思います。

投稿2023/06/13 19:22

yuki563781

総合スコア2

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

「node-sass」のコマンドが失敗しています。

ログを確認すると、以下のエラーが出ています。

error /tmp/build_cc3791e1/node_modules/node-sass: Command failed

さらにログを追っていくと、以下のエラーが出ています。

gyp verb check python checking for Python executable "python2" in the PATH gyp verb `which` failed Error: not found: python2

このエラーの原因は、node-sassが依存しているnode-gypがpython2を使用しているのと、
Heroku-22スタックからpython2が含まれなくなったために起きています。

node-sassは非推奨とされているため、Dart Sass(npmのパッケージ名はsass)に移行することが望ましいです。

参考:
https://devcenter.heroku.com/ja/articles/heroku-22-stack
https://www.npmjs.com/package/node-sass

投稿2023/04/21 21:07

Eggpan

総合スコア2727

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

yuki1083kk

2023/06/13 19:34

お返事遅くなり大変申し訳ございません。 お忙しい中ご返答いただきありがとうございました。 ご回答の通り、試行錯誤、四苦八苦なんとかやってみようと思います。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問