前提・実現したいこと
vagrantとvirtualboxで構成した仮想環境のubuntu上で作業しており、slackのbotをNode.jsで作成しました。それをherokuで運用するためにgit push heroku masterをするとエラーが出て困っています。
[追記]
heroku公式のトラブルシューティングページを見て後述のように適切にバージョンを揃えればいけると思いましたが、うまくいきません...
発生している問題・エラーメッセージ
Counting objects: 27, done. Delta compression using up to 2 threads. Compressing objects: 100% (24/24), done. Writing objects: 100% (27/27), 19.24 KiB | 0 bytes/s, done. Total 27 (delta 7), reused 0 (delta 0) 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: NODE_ENV=production remote: NODE_MODULES_CACHE=true remote: NODE_VERBOSE=false remote: remote: -----> Installing binaries remote: engines.node (package.json): 8.9.4 remote: engines.npm (package.json): 6.11.3 remote: remote: Resolving node version 8.9.4... remote: Downloading and installing node 8.9.4... remote: Bootstrapping npm 6.11.3 (replacing 5.6.0)... remote: npm 6.11.3 installed remote: remote: -----> Installing dependencies remote: Installing node modules (package.json + package-lock) remote: added 160 packages from 127 contributors and audited 275 packages in 4.989s remote: found 0 vulnerabilities remote: remote: remote: -----> Build remote: remote: -----> Pruning devDependencies remote: npm ERR! code ENOENT remote: npm ERR! syscall access remote: npm ERR! path node_modules/todo remote: npm ERR! errno -2 remote: npm ERR! enoent ENOENT: no such file or directory, access 'node_modules/todo' remote: npm ERR! enoent This is related to npm not being able to find a file. remote: npm ERR! enoent remote: remote: npm ERR! A complete log of this run can be found in: remote: npm ERR! /tmp/npmcache.c51q2/_logs/2019-09-13T14_06_03_165Z-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 pacific-mountain-32175. remote: To https://git.heroku.com/pacific-mountain-32175.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/pacific-mountain-32175.git'
試したこと
wget -qO- https://cli-assets.heroku.com/install-ubuntu.sh | sh
でherokuCLIを入れ、
heroku login --interactive
でログインし、
heroku create
した後に
git push heroku master
しました。
[追記]
GitHubから
Upgrade ws to version 3.3.1 or later. For example: "dependencies": { "ws": ">=3.3.1" } or… "devDependencies": { "ws": ">=3.3.1" }
というpackage-lock.jsonのwsのバージョンの脆弱性についてのメールがきたのでhttps://webrandum.net/github-package-lock-json-error/を参考にしてnpm-check-updatesをインストールして更新しましたが何も変更されませんでした。これも関係あるのでしょうか?
[追記]
さらに調査を進め、https://teratail.com/questions/156019の質問を見て、ローカルのバージョンとpackage.jsonに記載のバージョンを合わせればいけると考えました。
公式のトラブルシューティングページhttps://devcenter.heroku.com/articles/troubleshooting-node-deploys#check-your-buildpackを参考にCheck your buildpackに書かれたことを実行し、Compare Node and npm Versionsを読んで、package.jsonのenginesをvimで
"engines": { "node": "8.9.4", "npm": "6.11.3" }
というふうに、下の補足情報に書いたローカルのバージョンと合うように書き換え、コミットしてプッシュした後にgit push heroku masterしたところ上記のようなエラーが出てしましました。
補足情報(FW/ツールのバージョンなど)
heroku/7.29.0 linux-x64 node-v11.14.0
v8.9.4(node --versionの結果)
6.11.3(npm --versionの結果)
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。