- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在使用 ionic 2 构建一个平均堆栈应用程序,我想将其托管在 Heroku 上。该应用程序已完成并在本地运行良好,我已将其连接到 mLabs 数据库。当我将应用程序推送到 Heroku 时,我在日志中收到以下错误。
2017-04-10T12:32:15.558949+00:00 app[web.1]: Error: Cannot find module 'mongoose'
2017-04-10T12:32:15.558953+00:00 app[web.1]: at Module._compile (module.js:570:32)
2017-04-10T12:32:15.558954+00:00 app[web.1]: at Object.Module._extensions..js (module.js:579:10)
2017-04-10T12:32:15.558951+00:00 app[web.1]: at Function.Module._load (module.js:417:25)
2017-04-10T12:32:15.558952+00:00 app[web.1]: at require (internal/module.js:20:19)
2017-04-10T12:32:15.558952+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:4:16)
2017-04-10T12:32:15.558951+00:00 app[web.1]: at Module.require (module.js:497:17)
2017-04-10T12:32:15.558954+00:00 app[web.1]: at Module.load (module.js:487:32)
2017-04-10T12:32:15.558955+00:00 app[web.1]: at Function.Module._load (module.js:438:3)
2017-04-10T12:32:15.558955+00:00 app[web.1]: at tryModuleLoad (module.js:446:12)
2017-04-10T12:32:15.558950+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:469:15)
2017-04-10T12:32:15.567486+00:00 app[web.1]:
2017-04-10T12:32:15.577504+00:00 app[web.1]: npm ERR! Linux 3.13.0-112-generic
2017-04-10T12:32:15.577867+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2017-04-10T12:32:15.578113+00:00 app[web.1]: npm ERR! node v6.10.2
2017-04-10T12:32:15.578341+00:00 app[web.1]: npm ERR! npm v3.10.10
2017-04-10T12:32:15.578578+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-04-10T12:32:15.578785+00:00 app[web.1]: npm ERR! ionic-hello-world@ start: `node server.js`
2017-04-10T12:32:15.578954+00:00 app[web.1]: npm ERR! Exit status 1
2017-04-10T12:32:15.579249+00:00 app[web.1]: npm ERR!
2017-04-10T12:32:15.579426+00:00 app[web.1]: npm ERR! Failed at the ionic-hello-world@ start script 'node server.js'.
2017-04-10T12:32:15.579621+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2017-04-10T12:32:15.579920+00:00 app[web.1]: npm ERR! not with npm itself.
2017-04-10T12:32:15.579746+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the ionic-hello-world package,
2017-04-10T12:32:15.580101+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2017-04-10T12:32:15.580265+00:00 app[web.1]: npm ERR! node server.js
2017-04-10T12:32:15.580757+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2017-04-10T12:32:15.580428+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2017-04-10T12:32:15.580601+00:00 app[web.1]: npm ERR! npm bugs ionic-hello-world
2017-04-10T12:32:15.580878+00:00 app[web.1]: npm ERR! npm owner ls ionic-hello-world
2017-04-10T12:32:15.580993+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2017-04-10T12:32:15.588769+00:00 app[web.1]:
2017-04-10T12:32:15.589345+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2017-04-10T12:32:15.589646+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2017-04-10T12:32:15.679397+00:00 heroku[web.1]: State changed from starting to crashed
2017-04-10T12:32:15.680194+00:00 heroku[web.1]: State changed from crashed to starting
2017-04-10T12:32:15.673049+00:00 heroku[web.1]: Process exited with status 1
2017-04-10T12:32:18.568796+00:00 heroku[web.1]: Starting process with command `npm start`
2017-04-10T12:32:21.743026+00:00 app[web.1]:
2017-04-10T12:32:21.743041+00:00 app[web.1]: > ionic-hello-world@ start /app
2017-04-10T12:32:21.743042+00:00 app[web.1]: > node server.js
2017-04-10T12:32:21.743042+00:00 app[web.1]:
2017-04-10T12:32:22.058223+00:00 app[web.1]: module.js:471
2017-04-10T12:32:22.058237+00:00 app[web.1]: ^
2017-04-10T12:32:22.058236+00:00 app[web.1]: throw err;
2017-04-10T12:32:22.058239+00:00 app[web.1]: Error: Cannot find module 'mongoose'
2017-04-10T12:32:22.058238+00:00 app[web.1]:
2017-04-10T12:32:22.058241+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:469:15)
2017-04-10T12:32:22.058242+00:00 app[web.1]: at Function.Module._load (module.js:417:25)
2017-04-10T12:32:22.058242+00:00 app[web.1]: at Module.require (module.js:497:17)
2017-04-10T12:32:22.058243+00:00 app[web.1]: at require (internal/module.js:20:19)
2017-04-10T12:32:22.058243+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:4:16)
2017-04-10T12:32:22.058244+00:00 app[web.1]: at Module._compile (module.js:570:32)
2017-04-10T12:32:22.058245+00:00 app[web.1]: at Object.Module._extensions..js (module.js:579:10)
2017-04-10T12:32:22.058245+00:00 app[web.1]: at Module.load (module.js:487:32)
2017-04-10T12:32:22.058246+00:00 app[web.1]: at tryModuleLoad (module.js:446:12)
2017-04-10T12:32:22.058246+00:00 app[web.1]: at Function.Module._load (module.js:438:3)
2017-04-10T12:32:22.067921+00:00 app[web.1]:
2017-04-10T12:32:22.080492+00:00 app[web.1]: npm ERR! Linux 3.13.0-112-generic
2017-04-10T12:32:22.080827+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2017-04-10T12:32:22.080991+00:00 app[web.1]: npm ERR! node v6.10.2
2017-04-10T12:32:22.081154+00:00 app[web.1]: npm ERR! npm v3.10.10
2017-04-10T12:32:22.081323+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-04-10T12:32:22.081657+00:00 app[web.1]: npm ERR! Exit status 1
2017-04-10T12:32:22.081825+00:00 app[web.1]: npm ERR!
2017-04-10T12:32:22.081993+00:00 app[web.1]: npm ERR! Failed at the ionic-hello-world@ start script 'node server.js'.
2017-04-10T12:32:22.082162+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2017-04-10T12:32:22.081490+00:00 app[web.1]: npm ERR! ionic-hello-world@ start: `node server.js`
2017-04-10T12:32:22.082332+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the ionic-hello-world package,
2017-04-10T12:32:22.082335+00:00 app[web.1]: npm ERR! not with npm itself.
2017-04-10T12:32:22.082498+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2017-04-10T12:32:22.082666+00:00 app[web.1]: npm ERR! node server.js
2017-04-10T12:32:22.082832+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2017-04-10T12:32:22.083001+00:00 app[web.1]: npm ERR! npm bugs ionic-hello-world
2017-04-10T12:32:22.083168+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2017-04-10T12:32:22.083170+00:00 app[web.1]: npm ERR! npm owner ls ionic-hello-world
2017-04-10T12:32:22.083338+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2017-04-10T12:32:22.092234+00:00 app[web.1]:
2017-04-10T12:32:22.092236+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2017-04-10T12:32:22.092237+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2017-04-10T12:32:22.188511+00:00 heroku[web.1]: Process exited with status 1
2017-04-10T12:32:22.201942+00:00 heroku[web.1]: State changed from starting to crashed
2017-04-10T12:32:50.415338+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=dry-retreat-69141.herokuapp.com request_id=898a0974-f3eb-47b2-a7ca-77a37cf99131 fwd="193.1.57.4" dyno= connect= service= status=503 bytes= protocol=https
2017-04-10T12:35:00.000000+00:00 app[api]: Build started by user alanmurphy1995@gmail.com
2017-04-10T12:36:27.620672+00:00 app[api]: Release v6 created by user alanmurphy1995@gmail.com
2017-04-10T12:36:27.620672+00:00 app[api]: Deploy 9f02cb4 by user alanmurphy1995@gmail.com
2017-04-10T12:36:27.804049+00:00 heroku[web.1]: State changed from crashed to starting
2017-04-10T12:36:27.782474+00:00 app[api]: Release v6 created by user alanmurphy1995@gmail.com
2017-04-10T12:35:00.000000+00:00 app[api]: Build succeeded
2017-04-10T12:36:33.381932+00:00 heroku[web.1]: Starting process with command `npm start`
2017-04-10T12:36:36.544686+00:00 app[web.1]:
2017-04-10T12:36:36.544709+00:00 app[web.1]: > ionic-hello-world@ start /app
2017-04-10T12:36:36.544710+00:00 app[web.1]: > node server.js
2017-04-10T12:36:36.544711+00:00 app[web.1]:
2017-04-10T12:36:37.082619+00:00 app[web.1]: App listening on port 8080
2017-04-10T12:37:33.784488+00:00 app[web.1]: Error waiting for process to terminate: No child processes
2017-04-10T12:37:33.760270+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2017-04-10T12:37:33.760270+00:00 heroku[web.1]: Stopping process with SIGKILL
2017-04-10T12:37:33.878656+00:00 heroku[web.1]: Process exited with status 22
2017-04-10T12:37:33.889982+00:00 heroku[web.1]: State changed from starting to crashed
2017-04-10T12:37:34.773926+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=dry-retreat-69141.herokuapp.com request_id=6ba08c4e-a269-4530-b0db-192da56e2724 fwd="193.1.57.4" dyno= connect= service= status=503 bytes= protocol=https
作为引用,这是我的 server.js 文件
// Set up
var express = require('express');
var app = express(); // create our app w/ express
var mongoose = require('mongoose'); // mongoose for mongodb
var morgan = require('morgan'); // log requests to the console (express4)
var bodyParser = require('body-parser'); // pull information from HTML POST (express4)
var methodOverride = require('method-override'); // simulate DELETE and PUT (express4)
var cors = require('cors');
// Configuration
//mongoose.connect('mongodb://localhost/reviewking');
mongoose.connect('Connecting to mLabs here URI not included for security reasons');
app.use(morgan('dev')); // log every request to the console
app.use(bodyParser.urlencoded({'extended':'true'})); // parse application/x-www-form-urlencoded
app.use(bodyParser.json()); // parse application/json
app.use(bodyParser.json({ type: 'application/vnd.api+json' })); // parse application/vnd.api+json as json
app.use(methodOverride());
app.use(cors());
app.use(express.static("www")); // Our Ionic app build is in the www folder (kept up-to-date by the Ionic CLI using 'ionic serve')
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header('Access-Control-Allow-Methods', 'DELETE, PUT');
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
// Models
var Review = mongoose.model('Review', {
title: String,
description: String,
rating: Number
});
// Routes
// Get reviews
app.get('/api/reviews', function(req, res) {
console.log("fetching reviews");
// use mongoose to get all reviews in the database
Review.find(function(err, reviews) {
// if there is an error retrieving, send the error. nothing after res.send(err) will execute
if (err)
res.send(err)
res.json(reviews); // return all reviews in JSON format
});
});
// create review and send back all reviews after creation
app.post('/api/reviews', function(req, res) {
console.log("creating review");
// create a review, information comes from request from Ionic
Review.create({
title : req.body.title,
description : req.body.description,
rating: req.body.rating,
done : false
}, function(err, review) {
if (err)
res.send(err);
// get and return all the reviews after you create another
Review.find(function(err, reviews) {
if (err)
res.send(err)
res.json(reviews);
});
});
});
// delete a review
app.delete('/api/reviews/:review_id', function(req, res) {
Review.remove({
_id : req.params.review_id
}, function(err, review) {
});
});
// listen (start app with node server.js) ======================================
app.listen(8080);
console.log("App listening on port 8080");
这是我的 package.json 文件。
{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve",
"start": "node server.js"
},
"dependencies": {
"@angular/common": "2.2.1",
"@angular/compiler": "2.2.1",
"@angular/compiler-cli": "2.2.1",
"@angular/core": "2.2.1",
"@angular/forms": "2.2.1",
"@angular/http": "2.2.1",
"@angular/platform-browser": "2.2.1",
"@angular/platform-browser-dynamic": "2.2.1",
"@angular/platform-server": "2.2.1",
"@ionic/storage": "1.1.7",
"@types/cordova-plugin-network-information": "0.0.3",
"angularfire2": "^2.0.0-beta.6",
"firebase": "^3.3.0",
"ionic-angular": "2.1.0",
"ionic-native": "2.4.1",
"ionicons": "3.0.0",
"rxjs": "5.0.0-beta.12",
"sw-toolbox": "3.4.0",
"zone.js": "0.6.26",
"@ionic/app-scripts": "1.1.3",
"typescript": "2.0.9",
"mongoose": "^4.6.2",
"body-parser": "^1.15.2",
"cors": "^2.8.0",
"del": "2.2.0",
"express": "^4.14.0",
"http": "0.0.0",
"method-override": "^2.3.6",
"morgan": "^1.7.0",
"superlogin": "^0.6.1"
},
"devDependencies": {
"@ionic/app-scripts": "1.1.3",
"typescript": "2.0.9",
"mongoose": "^4.6.2",
"body-parser": "^1.15.2",
"cors": "^2.8.0",
"del": "2.2.0",
"express": "^4.14.0",
"http": "0.0.0",
"method-override": "^2.3.6",
"morgan": "^1.7.0",
"superlogin": "^0.6.1"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": [],
"description": "ReviewApp: An Ionic project"
}
任何有关此错误的帮助或解决此问题的解决方案(以便我可以将工作应用程序推送到 Heroku)都会有很大帮助。
最佳答案
从 devDependencies
中删除 mongoose
应该可以修复它。
说明:mongoose 在 package.json
中列出两次 - 一次在 dependency
中,一次在 devDependency
中,但 Heroku 不会安装它们。
我还建议您按字母顺序排列这些依赖项列表,以便将来更容易发现此类问题。
关于node.js - 使用 mongoose 在 Heroku 上托管 Express 应用程序时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43323743/
我正在尝试使用 Heroku Scheduler 在已部署的 Heroku 应用程序中调用 HTTP 端点,它基本上以固定速率在 Heroku bash 上运行命令。 当我运行 $ heroku ru
我有一个在 Heroku 上运行的应用程序,其中有一些我想不时更改的设置,并且我想使用 Heroku 配置变量来存储这些设置,以便它们持久存在。 我知道我可以从 Heroku 仪表板或 Heroku
我从模板 reagent-frontend 创建了一个 ClojureScript Reagent 应用程序。如何将生产应用程序部署到 Heroku?在为生产构建后(lein package/lein
我正在尝试在 heroku 上添加信用卡,然后消息显示“无法验证您的卡,请稍后再试或联系您的金融机构寻求帮助” 最佳答案 这是因为您的银行拒绝付款。 检查您是否输入了所有正确的详细信息 查看您银行的最
首先为我的英语感到抱歉,因为它不是我的母语,我不习惯它,它可能很难理解。 我正在尝试将我的 spike 应用程序连接到 heroku 以获取长期葡萄糖数据。 我在没有“部署分支”步骤的情况下成功完成了
Ec2 实例小时按小时计算。如果你只是启动和关闭一个实例,它仍然算作一小时。 Heroku 如何处理这个?按分钟还是按小时? 让我们假设我的应用程序使用超过 750 免费 Dyno 小时限制 最佳答案
好奇 heroku 如何创建应用程序名称。应用程序名称通常是英文单词,例如bloom-peaks 或formal-trail。一家大公司的 IT 部门也是如此。是否有用于名称生成的 unix 库? 最
有没有人在 Heroku 上成功使用过 docsplit?它有许多二进制依赖项。我已经搜索过,但没有找到任何人这样做。教程会很棒,但我真的很好奇其他人是否成功。 最佳答案 我的搜索没有找到任何做过这件
我想将一个应用程序部署到需要能够生成加密安全随机数的 heroku。我可以使用哪些熵源? 最佳答案 你的 Heroku dyno 基本上是一个 Ubuntu 服务器虚拟机,所以你应该可以访问 /dev
Heroku 可以显示自定义维护页面: heroku config:set MAINTENANCE_PAGE_URL=http://some_server/my_page.html 这需要某些网站的存
我正在开始使用 Heroku,并担心它是否会因我犯的错误而向我收费。例如,填充数据库超过 5MB。 那么,有没有办法为 Heroku 或通知系统设置计费限制,以便在我超过价格限制时发送通知? 先感谢您
如何更新我的 Heroku ,我的 Windows 终端显示以下内容: » Warning: heroku update available from 7.47.7 to 7.52.0. 请帮忙
我在免费的 Dyno 上运行基于 NodeJS 的应用程序,连接到 mongohq-MongoDB。我想迁移它以使用爱好 Dyno,这样做的动机不仅是避免 sleep 时间,而且是为了实现更高的 HT
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 9年前关闭。 Improve this q
如何将我的生产数据库拉到 heroku 上的暂存服务器? 我有两个 Remote ,production 和 staging。 来自documentation看来我想运行 heroku pg:copy
我有一个域example.com,我想将它用于位于example.herokuapp.com 的rails-app,我很困惑如何去做。 Heroku says "Zone apex domains (
我有一个 sinatra 应用程序,其中有一个 yml 文件来设置环境变量,我使用此方法调用它们 module MyConfig def config environment = ENV["RA
根据各种因素,一整天中,我的应用程序的负载可能会出现非常极端的增加。 那时,我想自动增加测功机的数量。 我想增加加载时间。因此,如果加载页面需要X倍的时间,请增加测功力。否则,请往下走。 这样的东西存
我想知道使用heroku工具栏在heroku帐户之间进行切换的最佳方法是什么。 我曾经有一个个人的heroku帐户,它是我所有职业性的heroku应用程序的协作者。问题是当我想进行一些对财务有影响的更
是否可以停止部署到当前正在构建的 Heroku ( git push heroku )? 类似 heroku run stopit! 顺便提一句。成功部署后回滚不是我想要的。 最佳答案 首先,安装He
我是一名优秀的程序员,十分优秀!