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

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

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

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

Node.js

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

Q&A

解決済

1回答

763閲覧

突如node.jsコードのデプロイができなくなった。

退会済みユーザー

退会済みユーザー

総合スコア0

Heroku

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

Node.js

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

0グッド

0クリップ

投稿2020/07/05 04:10

前提・実現したいこと

discord.jsでボット(名前を△△△△△△△△とします)を開発しています。
一昨日は普通にデプロイできたのですが、昨日から急にデプロイができなくなりました。

herokuの仕様などをよく分かってないので、どこがおかしいのか本当に分かりません。

海外でのこういうった問題ではpackage.jsonに原因があることが多いらしいので、
念の為にpackage.jsonの内容も記載します。

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

git add .

console

1warning: LF will be replaced by CRLF in package.json. 2The file will have its original line endings in your working directory

git commit -am "make it better"

console

1[master 6b58e48] make it better 2 1 file changed, 1 insertion(+), 2 deletions(-)

git push heroku master

console

1Enumerating objects: 914, done. 2Counting objects: 100% (914/914), done. 3Delta compression using up to 4 threads 4Compressing objects: 100% (828/828), done. 5Writing objects: 100% (859/859), 14.88 MiB | 254.00 KiB/s, done. 6Total 859 (delta 156), reused 0 (delta 0) 7remote: Compressing source files... done. 8remote: Building source: 9remote: 10remote: -----> Node.js app detected 11remote: 12remote: -----> Creating runtime environment 13remote: 14remote: NPM_CONFIG_LOGLEVEL=error 15remote: NODE_ENV=production 16remote: NODE_MODULES_CACHE=true 17remote: NODE_VERBOSE=false 18remote: 19remote: -----> Installing binaries 20remote: engines.node (package.json): 12.18.x 21remote: engines.npm (package.json): unspecified (use default) 22remote: 23remote: Resolving node version 12.18.x... 24remote: Downloading and installing node 12.18.2... 25remote: Using default npm version: 6.14.5 26remote: 27remote: -----> Restoring cache 28remote: - node_modules is checked into source control and cannot be cached 29remote: 30remote: -----> Installing dependencies 31remote: Prebuild detected (node_modules already exists) 32remote: Rebuilding any native modules 33remote: 34remote: > canvas@2.6.1 install /tmp/build_0a47e560b053fe013f9a0d1dae6ac85c/node_modules/canvas 35remote: > node-pre-gyp install --fallback-to-build 36remote: 37remote: sh: 1: node-pre-gyp: Permission denied 38remote: npm ERR! code ELIFECYCLE 39remote: npm ERR! errno 126 40remote: npm ERR! canvas@2.6.1 install: `node-pre-gyp install --fallback-to-build` 41remote: npm ERR! Exit status 126 42remote: npm ERR! 43remote: npm ERR! Failed at the canvas@2.6.1 install script. 44remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 45remote: 46remote: npm ERR! A complete log of this run can be found in: 47remote: npm ERR! /tmp/npmcache.Hjul7/_logs/2020-07-05T02_59_22_456Z-debug.log 48remote: 49remote: -----> Build failed 50remote: 51remote: We're sorry this build is failing! You can troubleshoot common issues here: 52remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys 53remote: 54remote: Some possible problems: 55remote: 56remote: - node_modules checked into source control 57remote: https://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits 58remote: 59remote: Love, 60remote: Heroku 61remote: 62remote: ! Push rejected, failed to compile Node.js app. 63remote: 64remote: ! Push failed 65remote: Verifying deploy... 66remote: 67remote: ! Push rejected to △△△△△△△△. 68remote: 69To https://git.heroku.com/△△△△△△△△.git 70 ! [remote rejected] master -> master (pre-receive hook declined) 71error: failed to push some refs to 'https://git.heroku.com/△△△△△△△△.git'

該当のソースコード

package.json

json

1{ 2 "name": "△△△△△△△△", 3 "version": "1.0.0", 4 "description": "test", 5 "main": "server.js", 6 "scripts": { 7 "test": "node server.js" 8 }, 9 "author": "me", 10 "license": "ISC", 11 "dependencies": { 12 "canvas": "^2.6.1", 13 "discord.js": "^12.2.0", 14 "fs": "0.0.1-security", 15 "http": "0.0.1-security", 16 "sync-request": "^6.1.0", 17 "ws": "^7.3.0" 18 }, 19 "engines": { 20 "node": "12.18.x" 21 } 22}

試したこと

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

version

1VScode 2npm 6.14.4 3ares 1.16.0 4brotli 1.0.7 5cldr 37.0 6http_parser 2.9.3 7icu 67.1 8llhttp 2.0.4 9modules 72 10napi 6 11nghttp2 1.41.0 12node 12.18.0 13openssl 1.1.1g 14tz 2019c 15unicode 13.0 16uv 1.37.0 17v8 7.8.279.23-node.37 18zlib 1.2.11

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

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

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

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

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

退会済みユーザー

退会済みユーザー

2020/07/05 10:59

申し訳ございません。エラーが発生しデプロイできませんでした。 エラー内容は上記と同じです。
guest

回答1

0

ベストアンサー

Prebuild detected (node_modules already exists)

となっているのでnode_modulesをリポジトリにcommitしていませんか?
buildするnpmパッケージは環境によってビルド方法が異なるので、既に余計な物が入ってしまっていてherokuで落ちているのではないかと思います。
node_modules.gitignore に追加した上で

git rm -r --cached node_modules git commit -m 'Remove node_modules'

してからherokuにpushしてみてください。

投稿2020/07/12 02:40

yuki-yano

総合スコア132

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問