- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个 postinstall
脚本,我假设每当您执行 git push heroku master
时都会调用该脚本。但由于某种原因,推送失败了。我在 Windows 上,必须对某些脚本使用 cross-env
包。我认为这可能会导致它失败,但我不确定。
这是终端输出的图像: image
Heroku 日志位于底部
以下是脚本:
"build": "cross-env NODE_ENV=production webpack && gulp",
"postinstall": "npm run build"
以下是 webpack 和 gulp 文件:
const webpack = require('webpack');
const path = require('path');
module.exports = {
entry: {
app: './src/app.js',
},
output: {
filename: 'public/build/bundle.js',
sourceMapFilename: 'public/build/bundle.map',
},
devtool: '#source-map',
plugins:
process.env.NODE_ENV === 'production'
? [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}),
new webpack.optimize.UglifyJsPlugin({
minimize: true,
compress: {
warnings: true,
},
}),
]
: [],
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules)/,
loader: 'babel-loader',
query: {
presets: ['react', 'es2015', 'stage-1'],
},
},
],
},
};
<小时/>
var gulp = require('gulp');
var less = require('gulp-less');
var gp_concat = require('gulp-concat');
var gp_rename = require('gulp-rename');
var gp_uglify = require('gulp-uglify');
var minifyCSS = require('gulp-minify-css');
var autoprefixer = require('gulp-autoprefixer');
var path = require('path');
gulp.task('css', () => {
return gulp
.src([
'./public/assets/css/font-awesome.main.css',
'./public/assets/css/ie8.css',
'./public/assets/css/main.css'
])
.pipe(minifyCSS())
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9'))
.pipe(gp_concat('style.min.css'))
.pipe(gulp.dest('./public/build/css'));
});
gulp.task('build', () => {
return gulp
.src([
'./public/assets/js/jquery.min.js',
'./public/assets/js/jquery.poptrox.min.js',
'./public/assets/js/skel.min.js',
'./public/assets/js/util.js',
'./public/assets/js/ie/respond.min.js',
'./public/assets/js/main.js'
])
.pipe(gp_concat('gulp-concat.js'))
.pipe(gulp.dest('./public/min'))
.pipe(gp_rename('vendor.min.js'))
.pipe(gp_uglify())
.pipe(gulp.dest('./public/build/'));
});
gulp.task('default', ['css', 'build'], () => {});
<小时/>
2017-09-18T13:55:31.499365+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2017-09-18T13:55:31.499511+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2017-09-18T13_55_31_493Z-debug.log
2017-09-18T13:55:31.615780+00:00 heroku[web.1]: Process exited with status 1
2017-09-18T13:55:33.147165+00:00 app[web.1]:
2017-09-18T13:55:33.147188+00:00 app[web.1]: > snapshot@0.0.0 start /app
2017-09-18T13:55:33.147189+00:00 app[web.1]: > node ./bin/www
2017-09-18T13:55:33.147190+00:00 app[web.1]:
2017-09-18T13:55:33.760733+00:00 app[web.1]: /app/node_modules/client-sessions/lib/client-sessions.js:548
2017-09-18T13:55:33.760762+00:00 app[web.1]: throw new Error("cannot set up sessions without a secret "+
2017-09-18T13:55:33.760764+00:00 app[web.1]: ^
2017-09-18T13:55:33.760765+00:00 app[web.1]:
2017-09-18T13:55:33.760770+00:00 app[web.1]: Error: cannot set up sessions without a secret or encryptionKey/signatureKe
y pair
2017-09-18T13:55:33.760770+00:00 app[web.1]: at clientSessionFactory (/app/node_modules/client-sessions/lib/client-s
essions.js:548:11)
2017-09-18T13:55:33.760771+00:00 app[web.1]: at Object.<anonymous> (/app/app.js:35:3)
2017-09-18T13:55:33.760771+00:00 app[web.1]: at Module._compile (module.js:570:32)
2017-09-18T13:55:33.760772+00:00 app[web.1]: at Object.Module._extensions..js (module.js:579:10)
2017-09-18T13:55:33.760772+00:00 app[web.1]: at Module.load (module.js:487:32)
2017-09-18T13:55:33.760773+00:00 app[web.1]: at tryModuleLoad (module.js:446:12)
2017-09-18T13:55:33.760773+00:00 app[web.1]: at Function.Module._load (module.js:438:3)
2017-09-18T13:55:33.760774+00:00 app[web.1]: at require (internal/module.js:20:19)
2017-09-18T13:55:33.760773+00:00 app[web.1]: at Module.require (module.js:497:17)
2017-09-18T13:55:33.760774+00:00 app[web.1]: at Object.<anonymous> (/app/bin/www:7:11)
2017-09-18T13:55:33.760775+00:00 app[web.1]: at Module._compile (module.js:570:32)
2017-09-18T13:55:33.760775+00:00 app[web.1]: at Object.Module._extensions..js (module.js:579:10)
2017-09-18T13:55:33.760775+00:00 app[web.1]: at Module.load (module.js:487:32)
2017-09-18T13:55:33.760776+00:00 app[web.1]: at Function.Module._load (module.js:438:3)
2017-09-18T13:55:33.760776+00:00 app[web.1]: at tryModuleLoad (module.js:446:12)
2017-09-18T13:55:33.760776+00:00 app[web.1]: at Module.runMain (module.js:604:10)
2017-09-18T13:55:33.760777+00:00 app[web.1]: at run (bootstrap_node.js:389:7)
2017-09-18T13:55:33.760777+00:00 app[web.1]: at startup (bootstrap_node.js:149:9)
2017-09-18T13:55:33.760778+00:00 app[web.1]: at bootstrap_node.js:502:3
2017-09-18T13:55:33.774695+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-09-18T13:55:33.775459+00:00 app[web.1]: npm ERR! errno 1
2017-09-18T13:55:33.776542+00:00 app[web.1]: npm ERR! snapshot@0.0.0 start: `node ./bin/www`
2017-09-18T13:55:33.776626+00:00 app[web.1]: npm ERR! Exit status 1
2017-09-18T13:55:33.776766+00:00 app[web.1]: npm ERR!
2017-09-18T13:55:33.776875+00:00 app[web.1]: npm ERR! Failed at the snapshot@0.0.0 start script.
2017-09-18T13:55:33.776951+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additiona
l logging output above.
2017-09-18T13:55:33.783741+00:00 app[web.1]:
2017-09-18T13:55:33.783984+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2017-09-18T13:55:33.784118+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2017-09-18T13_55_33_780Z-debug.log
2017-09-18T13:55:33.871079+00:00 heroku[web.1]: Process exited with status 1
2017-09-18T13:55:33.883665+00:00 heroku[web.1]: State changed from starting to crashed
2017-09-18T13:55:52.250660+00:00 heroku[web.1]: State changed from crashed to starting
2017-09-18T13:55:52.048172+00:00 app[api]: Set SESSION_SECRET config vars by user tbaustin1992@gmail.com
2017-09-18T13:55:52.048172+00:00 app[api]: Release v7 created by user tbaustin1992@gmail.com
2017-09-18T13:55:55.840695+00:00 heroku[web.1]: Starting process with command `npm start`
2017-09-18T13:55:58.323084+00:00 app[web.1]:
2017-09-18T13:55:58.323119+00:00 app[web.1]: > snapshot@0.0.0 start /app
2017-09-18T13:55:58.323120+00:00 app[web.1]: > node ./bin/www
2017-09-18T13:55:58.323121+00:00 app[web.1]:
2017-09-18T13:55:58.990350+00:00 app[web.1]: (node:18) DeprecationWarning: `open()` is deprecated in mongoose >= 4.11.0,
use `openUri()` instead, or set the `useMongoClient` option if using `connect()` or `createConnection()`. See http://mo
ngoosejs.com/docs/connections.html#use-mongo-client
2017-09-18T13:55:59.019980+00:00 app[web.1]: Db.prototype.authenticate method will no longer be available in the next ma
jor release 3.x as MongoDB 3.6 will only allow auth against users in the admin db and will no longer allow multiple cred
entials on a socket. Please authenticate using MongoClient.connect with auth credentials.
2017-09-18T13:55:59.068033+00:00 app[web.1]: DB CONNECT SUCCESS
2017-09-18T13:55:59.698175+00:00 heroku[web.1]: State changed from starting to up
2017-09-18T13:56:08.437795+00:00 heroku[router]: at=info method=GET path="/assets/js/main.js" host=ta-snapshot.herokuapp
.com request_id=a6710e07-a8f0-4745-9e1c-a235cb2a0252 fwd="24.192.32.162" dyno=web.1 connect=1ms service=6ms status=200 b
ytes=3324 protocol=https
2017-09-18T13:56:08.297473+00:00 heroku[router]: at=info method=GET path="/" host=ta-snapshot.herokuapp.com request_id=b
947354f-896e-464c-aadc-fc02cfc839e1 fwd="24.192.32.162" dyno=web.1 connect=1ms service=39ms status=200 bytes=1680 protoc
ol=https
2017-09-18T13:56:08.438162+00:00 heroku[router]: at=info method=GET path="/assets/js/util.js" host=ta-snapshot.herokuapp
.com request_id=bf8023a7-3cb1-4747-bd3c-a1ffaf1b723c fwd="24.192.32.162" dyno=web.1 connect=0ms service=6ms status=200 b
ytes=12722 protocol=https
2017-09-18T13:56:08.437227+00:00 heroku[router]: at=info method=GET path="/assets/js/skel.min.js" host=ta-snapshot.herok
uapp.com request_id=71672b98-4aa0-4afd-81ea-6fb051a8c62f fwd="24.192.32.162" dyno=web.1 connect=1ms service=6ms status=2
00 bytes=9373 protocol=https
2017-09-18T13:56:08.366497+00:00 heroku[router]: at=info method=GET path="/assets/js/jquery.min.js" host=ta-snapshot.her
okuapp.com request_id=1a37732e-e61e-49ac-b987-51eb0ea99e9e fwd="24.192.32.162" dyno=web.1 connect=1ms service=22ms statu
s=200 bytes=96247 protocol=https
2017-09-18T13:56:08.298920+00:00 app[web.1]: GET / 200 26.782 ms - 1477
2017-09-18T13:56:08.361855+00:00 app[web.1]: GET /assets/css/main.css 200 12.223 ms - 50410
2017-09-18T13:56:08.366349+00:00 app[web.1]: GET /assets/js/jquery.min.js 200 1.785 ms - 95957
2017-09-18T13:56:08.432865+00:00 app[web.1]: GET /assets/js/jquery.poptrox.min.js 200 1.283 ms - 12113
2017-09-18T13:56:08.435508+00:00 app[web.1]: GET /assets/js/skel.min.js 200 3.256 ms - 9085
2017-09-18T13:56:08.437044+00:00 app[web.1]: GET /assets/js/util.js 200 2.149 ms - 12433
2017-09-18T13:56:08.494412+00:00 app[web.1]: GET /build/bundle.js 200 1.214 ms - 1577443
2017-09-18T13:56:08.437610+00:00 app[web.1]: GET /assets/js/main.js 200 2.387 ms - 3037
2017-09-18T13:56:08.364794+00:00 heroku[router]: at=info method=GET path="/assets/css/main.css" host=ta-snapshot.herokua
pp.com request_id=ff43a00a-5fcf-4a41-b0f3-a971d06bac90 fwd="24.192.32.162" dyno=web.1 connect=1ms service=20ms status=20
0 bytes=50700 protocol=https
2017-09-18T13:56:08.434158+00:00 heroku[router]: at=info method=GET path="/assets/js/jquery.poptrox.min.js" host=ta-snap
shot.herokuapp.com request_id=83fd62f8-f6cc-486b-bf4b-4041a275a249 fwd="24.192.32.162" dyno=web.1 connect=1ms service=3m
s status=200 bytes=12402 protocol=https
2017-09-18T13:56:08.518895+00:00 heroku[router]: at=info method=GET path="/build/bundle.js" host=ta-snapshot.herokuapp.c
om request_id=2dd801e9-e899-4d4a-8a52-dc1fc67b613c fwd="24.192.32.162" dyno=web.1 connect=1ms service=44ms status=200 by
tes=1577736 protocol=https
2017-09-18T13:56:09.148354+00:00 app[web.1]: GET /assets/css/font-awesome.min.css 200 4.151 ms - 29063
2017-09-18T13:56:09.146219+00:00 heroku[router]: at=info method=GET path="/assets/css/font-awesome.min.css" host=ta-snap
shot.herokuapp.com request_id=39dfd327-c09a-45e4-855a-ebffaa27257c fwd="24.192.32.162" dyno=web.1 connect=1ms service=8m
s status=200 bytes=29353 protocol=https
2017-09-18T13:56:09.517771+00:00 app[web.1]: GET /account/currentuser 200 3.193 ms - 38
2017-09-18T13:56:09.548178+00:00 app[web.1]: GET /api/post?lat=40.7504753&lng=-73.9932668 200 26.721 ms - 39
2017-09-18T13:56:09.513895+00:00 heroku[router]: at=info method=GET path="/account/currentuser" host=ta-snapshot.herokua
pp.com request_id=65c8a776-9d5a-47fd-b477-db435f78b797 fwd="24.192.32.162" dyno=web.1 connect=1ms service=7ms status=200
bytes=245 protocol=https
2017-09-18T13:56:09.549304+00:00 heroku[router]: at=info method=GET path="/api/post?lat=40.7504753&lng=-73.9932668" host
=ta-snapshot.herokuapp.com request_id=16272576-6b17-4106-8836-afe0ce8bb34e fwd="24.192.32.162" dyno=web.1 connect=1ms se
rvice=33ms status=200 bytes=246 protocol=https
2017-09-18T13:56:10.263855+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=ta-snapshot.herokuapp.com r
equest_id=2a88ed05-0fad-4990-b29a-30ab227c02fc fwd="24.192.32.162" dyno=web.1 connect=1ms service=15ms status=404 bytes=
248 protocol=https
2017-09-18T13:56:10.259213+00:00 app[web.1]: GET /favicon.ico 404 9.124 ms - 41
2017-09-18T13:56:28.009172+00:00 heroku[router]: at=info method=POST path="/account/register" host=ta-snapshot.herokuapp
.com request_id=cf25e1dc-d704-4ea4-a4c0-f0688fdf8f83 fwd="24.192.32.162" dyno=web.1 connect=1ms service=241ms status=200
bytes=569 protocol=https
2017-09-18T13:56:28.001827+00:00 app[web.1]: { __v: 0,
2017-09-18T13:56:28.001851+00:00 app[web.1]: _id: 59bfd08b43dd250012c92e1e,
2017-09-18T13:56:28.001852+00:00 app[web.1]: timestamp: 2017-09-18T13:56:27.968Z,
2017-09-18T13:56:28.001853+00:00 app[web.1]: password: '$2a$10$70PiciKOFgd04G090zECtOGH2ufENQk7/3vDFkc3x0QgTdNEc8k72',
2017-09-18T13:56:28.001854+00:00 app[web.1]: username: 'tbaustin' }
2017-09-18T13:56:28.008043+00:00 app[web.1]: POST /account/register 200 238.870 ms - 128
2017-09-18T13:56:44.301208+00:00 app[web.1]: GET /api/post?lat=40.75076789772389&lng=-73.99052021796876 200 13.201 ms -
39
2017-09-18T13:56:44.302363+00:00 heroku[router]: at=info method=GET path="/api/post?lat=40.75076789772389&lng=-73.990520
21796876" host=ta-snapshot.herokuapp.com request_id=6b8e57d1-543d-4b0d-9447-28a7861c365a fwd="24.192.32.162" dyno=web.1
connect=1ms service=18ms status=200 bytes=246 protocol=https
2017-09-18T13:56:45.284274+00:00 heroku[router]: at=info method=GET path="/api/post?lat=40.75219835694907&lng=-73.993953
44550783" host=ta-snapshot.herokuapp.com request_id=9472bd9e-c88b-4ca0-888f-ba65dbc3cf83 fwd="24.192.32.162" dyno=web.1
connect=1ms service=13ms status=200 bytes=246 protocol=https
2017-09-18T13:56:45.284477+00:00 app[web.1]: GET /api/post?lat=40.75219835694907&lng=-73.99395344550783 200 10.603 ms -
39
2017-09-18T13:56:47.609169+00:00 heroku[router]: at=info method=GET path="/api/post?lat=40.75920391164151&lng=-73.990541
67564088" host=ta-snapshot.herokuapp.com request_id=2ba05865-34bf-433a-a6ba-388fcddfa95a fwd="24.192.32.162" dyno=web.1
connect=1ms service=10ms status=200 bytes=246 protocol=https
2017-09-18T13:56:47.607576+00:00 app[web.1]: GET /api/post?lat=40.75920391164151&lng=-73.99054167564088 200 4.460 ms - 3
9
2017-09-18T13:57:12.601209+00:00 app[web.1]: POST /api/post 200 31.164 ms - 341
2017-09-18T13:57:12.604731+00:00 heroku[router]: at=info method=POST path="/api/post" host=ta-snapshot.herokuapp.com req
uest_id=cb2ae99f-745c-460b-ac31-8c12fe476a40 fwd="24.192.32.162" dyno=web.1 connect=4ms service=37ms status=200 bytes=55
0 protocol=https
2017-09-18T14:33:24.565734+00:00 heroku[web.1]: Idling
2017-09-18T14:33:24.567184+00:00 heroku[web.1]: State changed from up to down
2017-09-18T14:33:25.533659+00:00 app[web.1]: Error waiting for process to terminate: No child processes
2017-09-18T14:33:25.472561+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2017-09-18T14:33:25.653495+00:00 heroku[web.1]: Process exited with status 22
2017-09-20T15:41:00.000000+00:00 app[api]: Build started by user tbaustin1992@gmail.com
2017-09-20T15:41:00.000000+00:00 app[api]: Build failed -- check your build logs
最佳答案
根据@skwidbreth提供,我在heroku日志中收到了session_secret错误。我想它没有以某种方式提供或定义。我在 .env 文件和 heroku 的配置变量中定义了它,但它仍然不起作用。
通过更改 webpack
文件以包含 SESSION_SECRET
来实现此目的。我将发布新的 webpack.config.js
您可以在 process.env
旁边看到我按照建议放置的位置。
const webpack = require('webpack');
const path = require('path');
module.exports = {
entry: {
app: './src/app.js',
},
output: {
filename: 'public/build/bundle.js',
sourceMapFilename: 'public/build/bundle.map',
},
devtool: '#source-map',
plugins:
process.env.NODE_ENV === 'production'
? [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
SESSION_SECRET: JSON.stringify(process.env.SESSION_SECRET),
}),
new webpack.optimize.UglifyJsPlugin({
minimize: true,
compress: {
warnings: true,
},
}),
]
: [],
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules)/,
loader: 'babel-loader',
query: {
presets: ['react', 'es2015', 'stage-1'],
},
},
],
},
};
关于node.js - 无法使用 npm 脚本推送到 heroku master "postinstall",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46326524/
我有 powershell 脚本。通过调度程序,我运行 bat 文件,该文件运行 PS1 文件。 BAT文件 Powershell.exe -executionpolicy remotesigned
什么更快? 或者 $.getScript('../js/SOME.js', function (){ ... // with $.ajaxSetup({ cache: true });
需要bash脚本来显示文件 #!/bin/bash my_ls() { # save current directory then cd to "$1" pushd "$1" >/dev/nu
我有一个输入 csv 文件,实际上我需要在输入文件中选择第 2 列和第 3 列值,并且需要转换两个值的时区(从 PT 到 CT),转换后我需要替换转换后的时区值到文件。 注意: 所有输入日期值都在太平
我正在使用/etc/init.d/httpd 作为 init.d 脚本的模板。我了解文件中发生的所有内容,但以下行除外: LANG=$HTTPD_LANG daemon --pidfile=${pid
我有以下选择: python runscript.py -O start -a "-a "\"-o \\\"-f/dev/sda1 -b256k -Q8\\\" -l test -p maim\""
我对 shell 脚本完全陌生,但我需要编写一个 shell 脚本来检查文件是否存在,然后移动到另一个位置 这是我写的: 一旦设备崩溃,我就会在/storage/sdcard1/1 中收集日志 #!/
我正在使用 bash 脚本从文本文件中读取数据。 数据: 04:31 Alex M.O.R.P.H. & Natalie Gioia - My Heaven http://goo.gl/rMOa2q
这是单击按钮时运行的 javascript 的结尾 xmlObj.open ('GET', /ajax.php, true); xmlObj.send (''); } 所以这会执行根目录中的php脚本
关闭。这个问题需要debugging details .它目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and th
我需要将文件转换为可读流以通过 api 上传,有一个使用 fs.createReadStream 的 Node js 示例。任何人都可以告诉我上述声明的 python 等价物是什么? 例子 const
我有一个 shell 脚本 cron,它从同一目录调用 python 脚本,但是当这个 cron 执行时,我没有从我的 python 脚本中获得预期的输出,当我手动执行它时,我的 python 脚本的
如何使 XMLHttpRequest (ajax) 调用的 php 脚本安全。 我的意思是,不让 PHP 文件通过直接 url 运行,只能通过脚本从我的页面调用(我不想向未登录的用户显示数据库结果,并
我正在尝试添加以下内容 我正在使用经典的 asp。但我不断收到的错误是“一个脚本 block 不能放在另一个脚本 block 内。”我尝试了此处的 document.write 技术:Javasc
如何从另一个 PHP 脚本(如批处理文件)中运行多个 PHP 脚本?如果我了解 include 在做什么,我认为 include 不会起作用;因为我正在运行的每个文件都会重新声明一些相同的函数等。我想
我想创建具有动态内容的网页。我有一个 HTML 页面,我想从中调用一个 lua 脚本 如何调用 lua 脚本? ? ? 从中检索数据?我可以做类似的事情吗: int xx = 0; xx
我删除了我的第一个问题,并重新编写了更多细节和附加 jSfiddle domos。 我有一个脚本,它运行查询并返回数据,然后填充表。表中的行自动循环滚动。所有这些工作正常,并通过使用以下代码完成。然而
我尝试使用 amp 脚本,但收到此错误: “[amp-script] 脚本哈希未找到。amp-script[script="hello-world"].js 必须在元[name="amp-script
我有一个读取输入的 Shell 脚本 #!/bin/bash echo "Type the year that you want to check (4 digits), followed by [E
我正在从 nodejs 调用 Lua 脚本。我想传递一个数组作为参数。我在 Lua 中解析该数组时遇到问题。 下面是一个例子: var script = 'local actorlist = ARGV
我是一名优秀的程序员,十分优秀!