- 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/
我在网上搜索但没有找到任何合适的文章解释如何使用 javascript 使用 WCF 服务,尤其是 WebScriptEndpoint。 任何人都可以对此给出任何指导吗? 谢谢 最佳答案 这是一篇关于
我正在编写一个将运行 Linux 命令的 C 程序,例如: cat/etc/passwd | grep 列表 |剪切-c 1-5 我没有任何结果 *这里 parent 等待第一个 child (chi
所以我正在尝试处理文件上传,然后将该文件作为二进制文件存储到数据库中。在我存储它之后,我尝试在给定的 URL 上提供文件。我似乎找不到适合这里的方法。我需要使用数据库,因为我使用 Google 应用引
我正在尝试制作一个宏,将下面的公式添加到单元格中,然后将其拖到整个列中并在 H 列中复制相同的公式 我想在 F 和 H 列中输入公式的数据 Range("F1").formula = "=IF(ISE
问题类似于this one ,但我想使用 OperatorPrecedenceParser 解析带有函数应用程序的表达式在 FParsec . 这是我的 AST: type Expression =
我想通过使用 sequelize 和 node.js 将这个查询更改为代码取决于在哪里 select COUNT(gender) as genderCount from customers where
我正在使用GNU bash,版本5.0.3(1)-发行版(x86_64-pc-linux-gnu),我想知道为什么简单的赋值语句会出现语法错误: #/bin/bash var1=/tmp
这里,为什么我的代码在 IE 中不起作用。我的代码适用于所有浏览器。没有问题。但是当我在 IE 上运行我的项目时,它发现错误。 而且我的 jquery 类和 insertadjacentHTMl 也不
我正在尝试更改标签的innerHTML。我无权访问该表单,因此无法编辑 HTML。标签具有的唯一标识符是“for”属性。 这是输入和标签的结构:
我有一个页面,我可以在其中返回用户帖子,可以使用一些 jquery 代码对这些帖子进行即时评论,在发布新评论后,我在帖子下插入新评论以及删除 按钮。问题是 Delete 按钮在新插入的元素上不起作用,
我有一个大约有 20 列的“管道分隔”文件。我只想使用 sha1sum 散列第一列,它是一个数字,如帐号,并按原样返回其余列。 使用 awk 或 sed 执行此操作的最佳方法是什么? Accounti
我需要将以下内容插入到我的表中...我的用户表有五列 id、用户名、密码、名称、条目。 (我还没有提交任何东西到条目中,我稍后会使用 php 来做)但由于某种原因我不断收到这个错误:#1054 - U
所以我试图有一个输入字段,我可以在其中输入任何字符,但然后将输入的值小写,删除任何非字母数字字符,留下“。”而不是空格。 例如,如果我输入: 地球的 70% 是水,-!*#$^^ & 30% 土地 输
我正在尝试做一些我认为非常简单的事情,但出于某种原因我没有得到想要的结果?我是 javascript 的新手,但对 java 有经验,所以我相信我没有使用某种正确的规则。 这是一个获取输入值、检查选择
我想使用 angularjs 从 mysql 数据库加载数据。 这就是应用程序的工作原理;用户登录,他们的用户名存储在 cookie 中。该用户名显示在主页上 我想获取这个值并通过 angularjs
我正在使用 autoLayout,我想在 UITableViewCell 上放置一个 UIlabel,它应该始终位于单元格的右侧和右侧的中心。 这就是我想要实现的目标 所以在这里你可以看到我正在谈论的
我需要与 MySql 等效的 elasticsearch 查询。我的 sql 查询: SELECT DISTINCT t.product_id AS id FROM tbl_sup_price t
我正在实现代码以使用 JSON。 func setup() { if let flickrURL = NSURL(string: "https://api.flickr.com/
我尝试使用for循环声明变量,然后测试cols和rols是否相同。如果是,它将运行递归函数。但是,我在 javascript 中执行 do 时遇到问题。有人可以帮忙吗? 现在,在比较 col.1 和
我举了一个我正在处理的问题的简短示例。 HTML代码: 1 2 3 CSS 代码: .BB a:hover{ color: #000; } .BB > li:after {
我是一名优秀的程序员,十分优秀!