6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

herokuにnodeのチャットアプリをデプロイした時のメモ

6
Posted at

heroku --verion : heroku-toolbelt/3.9.6 (x86_64-darwin10.8.0) ruby/1.9.3
node -v : v0.10.30
npm -v : 1.4.21
express --version : 4.2.0

軽く1時間はハマったのでメモ。

デプロイした時にエラー

Error: Cannot find module 'indexof'
    at Function.Module._resolveFilename <module.js:338:15>
    at Function.Module._load <module.js:280:25>
    at Module.require <module.js:364:17>
    at require <module.js:380:17>
    at Object.<anonymous> </app/node_modules/socket.io/node_modules/socket.io-parser/node_modules/emitter/index.js:6:13>
    at Module._compile <module.js:456:26>
    at Object.Module._extensions..js <module.js:474:10>
    at Module.load <module.js:356:32>
    at Functin.Module._load <module.js:312:12>
    at Module.require <module.js:364:17>

このようなエラーがどうしても解決できなかった。

http://stackoverflow.com/questions/23987571/node-js-app-works-locally-but-heroku-says-missing-module
に書いてあるようにしてみてもダメ。

他に原因があるのではと

  "engines":{
     "node": "0.10.x",
     "npm": "1.4.x"
  }

を見なおしてみたり、

web: npm start

に--productionを追加してみたり試行錯誤してもだめ。

解決したのは、エラー元(/node_modules/socket.io/node_modules/socket.io-parser/node_modules/emitter/index.js:6)をたどると
require('indexof')
だったので、dependenciesにindexofを追加してみた。

これで私は解決しました。

初めてのherokuへのnodeデプロイともあり、且つ初めてのnodeかつexpressだったので四苦八苦しました。

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?