本地测试时我以前运行:如何将我的Typescript Node.js应用程序部署到Heroku?
"build-live": "nodemon --exec ./node_modules/.bin/ts-node -r dotenv/config -- ./index.ts"
我后来想通我Procfile应该是这样的:
web: ./node_modules/.bin/ts-node -- ./index.ts
但它说模块“打字稿”没有找到,即使是在package.json
。我在几个地方读到ts-node
不是部署到Heroku的方式,所以我不知道该怎么做。
更新:我想我应该编译它,所以我尝试:
web: ./node_modules/.bin/tsc --module commonjs --allowJs --outDir build/ --sourceMap --target es6 index.ts && node build/index.js
然而,这成功,实际运行它,一堆我使用得到了林达的“无法找到模块“时......'”。
谢谢。这就说得通了。我从https://github.com/clundie/hello-world-node-typescript-heroku/blob/master/Procfile借用了Procfile,但看起来这是不好的做法,现在将是学习如何像特拉维斯一样使用CI。 如果您有任何建议,我现在遇到了tsc吹出我的文件夹之一的问题:http://stackoverflow.com/questions/43320132/how-to-require-this-file-with-tsc-tsc -seems到跳过的折射率那么它-不能待 – kayla