- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个使用 Grunt 的 Ionic 项目,它是由 Yeoman 构建的。我设法将其配置为在运行 Fedora 22 的本地计算机上正常工作。
目前,我正在尝试在 Centos 7 服务器实例上配置它,并且我在本地安装了所有依赖项,但是当我运行“grunt serve”时,出现以下错误:
Running "concurrent:server" (concurrent) task
Warning: FATAL ERROR: Evacuation Allocation failed - process out of memory Use --force to continue.
Aborted due to warnings.
我仍处于学习阶段,对上述技术经验不多,但目前我设法在本地使用它。
当我在我的终端“grunt serve --force”中运行时,应用程序正在运行,但它编译得不好,因为一些 css 有点乱,它显示以下警告:
Running "concurrent:server" (concurrent) task
Warning: FATAL ERROR: Evacuation Allocation failed - process out of memory Used --force, continuing.
Warning: FATAL ERROR: Evacuation Allocation failed - process out of memory Used --force, continuing.
我不认为内存在这里是个问题,因为服务器是专门为 UI 实例化的,其他一切都在其他服务器上,当我运行“free”时,它表明我有足够的可用空间:
总计 1015944 使用 169712 免费 780212
共享 13036增益/缓存 66020可用 742956
交换:0 0 0
这是我的 Gruntfile.js 的内容:
// Generated on 2015-02-06 using generator-angular 0.11.0
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
// Configurable paths for the application
var appConfig = {
app: require('./bower.json').appPath || 'app',
dist: 'www'
};
// Define the configuration for all the tasks
grunt.initConfig({
// Project settings
yeoman: appConfig,
// Ng constants - used for environment based configs
ngconstant: {
options: {
name: 'config',
wrap: '"use strict";\n\n{%= __ngModule %}',
space: ' '
},
local: {
options: {
dest: '<%= yeoman.app %>/scripts/config.js',
},
constants: {
ENV: 'local',
CONFIG: grunt.file.exists('config/local.config.json') ?
grunt.file.readJSON('config/local.config.json') :
grunt.file.readJSON('config/default.config.json')
}
},
dev: {
options: {
dest: '<%= yeoman.app %>/scripts/config.js',
},
constants: {
ENV: 'dev',
CONFIG: grunt.file.readJSON('config/dev.config.json')
}
}
},
// Watches files for changes and runs tasks based on the changed files
watch: {
bower: {
files: ['bower.json'],
tasks: ['wiredep']
},
js: {
files: ['<%= yeoman.app %>/scripts/{,*/}*.js', '<%= yeoman.app %>/scripts/{,*/}/{,*/}*.js'],
tasks: ['newer:jshint:all'],
options: {
livereload: '<%= connect.options.livereload %>'
}
},
html: {
files: ['<%= yeoman.app %>/views/{,*/}*.html', '<%= yeoman.app %>/*.html'],
tasks: [],
options: {
livereload: '<%= connect.options.livereload %>'
}
},
jsTest: {
files: ['test/spec/{,*/}*.js'],
tasks: ['newer:jshint:test', 'karma']
},
compass: {
files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
tasks: ['compass:server', 'autoprefixer']
},
ionic: {
files: ['<%= yeoman.app %>/ionic/scss/{,*/}*.{scss,sass}'],
tasks: ['compass:ionic', 'autoprefixer']
},
gruntfile: {
files: ['Gruntfile.js']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= yeoman.app %>/{,*/}*.html',
'.tmp/styles/{,*/}*.css',
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
]
}
},
// The actual grunt server settings
connect: {
options: {
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost',
livereload: 35729
},
livereload: {
options: {
open: true,
middleware: function (connect) {
return [
connect.static('.tmp'),
connect().use(
'/bower_components',
connect.static('./bower_components')
,function(req, res, next) {
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', '*');
next();
}
),
connect.static(appConfig.app),
];
}
}
},
test: {
options: {
port: 9001,
middleware: function (connect) {
return [
connect.static('.tmp'),
connect.static('test'),
connect().use(
'/bower_components',
connect.static('./bower_components')
),
connect.static(appConfig.app)
];
}
}
},
dist: {
options: {
open: true,
base: '<%= yeoman.dist %>'
}
}
},
// Make sure code styles are up to par and there are no obvious mistakes
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: {
src: [
'Gruntfile.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
]
},
test: {
options: {
jshintrc: 'test/.jshintrc'
},
src: ['test/spec/{,*/}*.js']
}
},
// Empties folders to start fresh
clean: {
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= yeoman.dist %>/{,*/}*',
'!<%= yeoman.dist %>/.git{,*/}*'
]
}]
},
server: '.tmp'
},
// Add vendor prefixed styles
autoprefixer: {
options: {
browsers: ['last 1 version']
},
dist: {
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
}
},
// Automatically inject Bower components into the app
wiredep: {
app: {
src: ['<%= yeoman.app %>/index.html'],
ignorePath: /\.\.\//
},
test: {
devDependencies: true,
src: '<%= karma.unit.configFile %>',
ignorePath: /\.\.\//,
fileTypes:{
js: {
block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi,
detect: {
js: /'(.*\.js)'/gi
},
replace: {
js: '\'{{filePath}}\','
}
}
}
},
sass: {
src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
ignorePath: /(\.\.\/){1,2}bower_components\//
}
},
// Compiles Sass to CSS and generates necessary files if requested
compass: {
options: {
sassDir: '<%= yeoman.app %>/styles',
cssDir: '.tmp/styles',
generatedImagesDir: '.tmp/images/generated',
imagesDir: '<%= yeoman.app %>/images',
javascriptsDir: '<%= yeoman.app %>/scripts',
fontsDir: '<%= yeoman.app %>/styles/fonts',
importPath: './bower_components',
httpImagesPath: '/images',
httpGeneratedImagesPath: '/images/generated',
httpFontsPath: '/styles/fonts',
relativeAssets: false,
assetCacheBuster: false,
raw: 'Sass::Script::Number.precision = 10\n'
},
dist: {
options: {
generatedImagesDir: '<%= yeoman.dist %>/images/generated'
}
},
server: {
options: {
sourcemap: true
}
},
ionic: {
options: {
debugInfo: true,
sassDir: '<%= yeoman.app %>/ionic/scss',
cssDir: '<%= yeoman.app %>/ionic/release/css',
fontsDir: '<%= yeoman.app %>/ionic/release/fonts',
httpFontsPath: '/fonts'
}
}
},
// Renames files for browser caching purposes
filerev: {
dist: {
src: [
'<%= yeoman.dist %>/scripts/{,*/}*.js',
'<%= yeoman.dist %>/styles/{,*/}*.css',
'<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
'<%= yeoman.dist %>/styles/fonts/*'
]
}
},
// Reads HTML for usemin blocks to enable smart builds that automatically
// concat, minify and revision files. Creates configurations in memory so
// additional tasks can operate on them
useminPrepare: {
html: '<%= yeoman.app %>/index.html',
options: {
dest: '<%= yeoman.dist %>',
flow: {
html: {
steps: {
js: ['concat', 'uglifyjs'],
css: ['cssmin']
},
post: {}
}
}
}
},
// Performs rewrites based on filerev and the useminPrepare configuration
usemin: {
html: ['<%= yeoman.dist %>/{,*/}*.html'],
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
options: {
assetsDirs: [
'<%= yeoman.dist %>',
'<%= yeoman.dist %>/images',
'<%= yeoman.dist %>/styles'
]
}
},
// The following *-min tasks will produce minified files in the dist folder
// By default, your `index.html`'s <!-- Usemin block --> will take care of
// minification. These next options are pre-configured if you do not wish
// to use the Usemin blocks.
// cssmin: {
// dist: {
// files: {
// '<%= yeoman.dist %>/styles/main.css': [
// '.tmp/styles/{,*/}*.css'
// ]
// }
// }
// },
// uglify: {
// dist: {
// files: {
// '<%= yeoman.dist %>/scripts/scripts.js': [
// '<%= yeoman.dist %>/scripts/scripts.js'
// ]
// }
// }
// },
// concat: {
// dist: {}
// },
imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.{png,jpg,jpeg,gif}',
dest: '<%= yeoman.dist %>/images'
}]
}
},
svgmin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.svg',
dest: '<%= yeoman.dist %>/images'
}]
}
},
htmlmin: {
dist: {
options: {
collapseWhitespace: true,
conservativeCollapse: true,
collapseBooleanAttributes: true,
removeCommentsFromCDATA: true,
removeOptionalTags: true
},
files: [{
expand: true,
cwd: '<%= yeoman.dist %>',
src: ['*.html', 'views/{,*/}*.html'],
dest: '<%= yeoman.dist %>'
}]
}
},
// ng-annotate tries to make the code safe for minification automatically
// by using the Angular long form for dependency injection.
ngAnnotate: {
dist: {
files: [{
expand: true,
cwd: '.tmp/concat/scripts',
src: ['*.js', '!oldieshim.js'],
dest: '.tmp/concat/scripts'
}]
}
},
// Replace Google CDN references
cdnify: {
dist: {
html: ['<%= yeoman.dist %>/*.html']
}
},
// Copies remaining files to places other tasks can use
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,png,txt}',
'.htaccess',
'*.html',
'views/{,*/}*.html',
'images/{,*/}*.{webp}',
'styles/fonts/{,*/}*.*'
]
}, {
expand: true,
cwd: '.tmp/images',
dest: '<%= yeoman.dist %>/images',
src: ['generated/*']
},
{
expand: true,
cwd: '<%= yeoman.app %>/ionic/release/fonts',
dest: '<%= yeoman.dist %>/fonts',
src: ['{,*/}*.*']
}]
},
styles: {
expand: true,
cwd: '<%= yeoman.app %>/styles',
dest: '.tmp/styles/',
src: '{,*/}*.css'
}
},
// Run some tasks in parallel to speed up the build process
concurrent: {
server: [
'compass:server',
'compass:ionic'
],
test: [
'compass',
'compass:ionic'
],
dist: [
'compass:dist',
'compass:ionic',
'imagemin',
'svgmin'
]
},
// Test settings
karma: {
unit: {
configFile: 'test/karma.conf.js',
singleRun: true
}
}
});
grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}
grunt.task.run([
'clean:server',
'ngconstant:local',
'wiredep',
'concurrent:server',
'autoprefixer',
'connect:livereload',
'watch'
]);
});
grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
grunt.task.run(['serve:' + target]);
});
grunt.registerTask('test', [
'clean:server',
'wiredep:test',
'concurrent:test',
'autoprefixer',
'connect:test',
'karma'
]);
grunt.registerTask('build', function (target) {
var ngconstant = typeof target !== 'undefined' ? 'ngconstant:'+target : 'ngconstant:dev';
grunt.task.run([
'clean:dist',
ngconstant,
'wiredep',
'useminPrepare',
'concurrent:dist',
'autoprefixer',
'concat',
'ngAnnotate',
'copy:dist',
'cdnify',
'cssmin',
'uglify',
'filerev',
'usemin',
'htmlmin'
]);
});
grunt.registerTask('default', [
'newer:jshint',
'test',
'build'
]);
};
最后,我设法以某种方式使用“grunt build”构建项目,但遇到了 grunt-contrib-imagemin 和 grunt-ng-annotate 的问题。在我将提到的版本更新为最新版本并运行“npm install”之前,我无法构建它。尽管如此,编译构建的项目仍然存在与上述相同的问题,图像无法显示并且 scss 丢失。
我通过在我的 Gruntfile 中取消注释以下内容解决了 scss 问题:
cssmin: {
dist: {
files: {
'<%= yeoman.dist %>/styles/main.css': [
'.tmp/styles/{,*/}*.css'
]
}
}
},
uglify: {
dist: {
files: {
'<%= yeoman.dist %>/scripts/scripts.js': [
'<%= yeoman.dist %>/scripts/scripts.js'
]
}
}
},
concat: {
dist: {}
},
imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.{png,jpg,jpeg,gif}',
dest: '<%= yeoman.dist %>/images'
}]
}
},
在 html 中硬编码的图像显示正常,但其他图像被缩小并重命名为例如 image.27c803.jpg,但应用程序仍然要求 image.jpg。所以,我暂时通过复制/images 文件夹中的源图像来解决它,但每次构建项目时都这样做是一项艰苦的工作。
最佳答案
我设法替代地解决了这个问题。我只是评论了重命名图像的行。现在图像被复制了它们的原始名称,但我不确定它们是否被缩小了。但是,它现在可以正常工作。
// Renames files for browser caching purposes
filerev: {
dist: {
src: [
'<%= yeoman.dist %>/scripts/{,*/}*.js',
'<%= yeoman.dist %>/styles/{,*/}*.css',
//'<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
'<%= yeoman.dist %>/styles/fonts/*'
]
}
},
关于concurrency - Centos 7 : Running "Grunt Serve" (concurrent) task 上的 Ionic "concurrent:server"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34314097/
我正在尝试在我的项目中使用 Knockout Concurrency 插件,目前我正在摆弄示例代码,但我没有让它工作: https://github.com/AndersMalmgren/Knocko
我正在尝试使用 grunt 运行多个监视任务,但似乎无法运行。我正在使用 grunt concurrent,但它似乎只运行我指定的一部分任务,只是短暂停止。 这是我的 gruntfile 的片段: c
我有一个使用 Grunt 的 Ionic 项目,它是由 Yeoman 构建的。我设法将其配置为在运行 Fedora 22 的本地计算机上正常工作。 目前,我正在尝试在 Centos 7 服务器实例上配
关闭。这个问题需要debugging details .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 1年前关闭。 Improve this question Co
Go is a concurrent lang 这是什么意思? 这是否意味着它是 C/C++/Java.. 的替代品? 最佳答案 A concurrent language是一种具有并发语言结构的语言
我正在尝试使用 Kafka 实现一个事件溯源系统,但遇到了以下问题。在新用户注册期间,我想检查用户提供的用户名是否已被使用。但是,请考虑 2 个用户尝试同时注册提供相同用户名的情况。 根据我对 ES
我正在完成 golang 之旅并进行最后的练习,将网络爬虫更改为并行爬行而不是重复爬行 (http://tour.golang.org/#73)。我只更改了抓取功能。 var used = m
ruby 版本 2.5.3 当我输入 rails new upload_app 时,出现以下错误 错误如下 Traceback (most recent call last): 39: fro
func main() { jobs := []Job{job1, job2, job3} numOfJobs := len(jobs) resultsChan := make
我正在尝试在 Rust async-await(即将稳定)中同时(而不是按顺序)运行 futures 列表,直到它们中的任何一个解析为 true . 想象一下有一个 Vec ,以及为每个文件运行的 f
当我看到这段代码时出现了问题: private static volatile ConcurrentHashMap cMap = null; static { cMap = new Concu
刚在lab环境下安装dcos环境,在centos7 linux机器上尝试安装dcos客户端时得到 **[root@rmavmdock5 dcos]# bash install.sh . http://
为什么要为 Scala fork ForkJoinPool? 哪种实现方式和哪种情况更受欢迎? 最佳答案 scala 库拥有自己的 ForkJoinPool 副本的明显原因是 scala 必须在 1.
是的,我知道。关于 NSOperation 世界有很多问题和答案,但我仍然有一些疑问。我会尝试用两部分的问题来解释我的疑虑。它们相互关联。 在 SO 帖子中 nsoperationqueue-and-
我将 Play Framework 2.1.1 与一个生成 java.util.concurrent.Future 结果的外部 java 库一起使用。我使用的是 scala future 而不是 Ak
我们使用 Doug Lea 的并发库已有 8 年多了。出于向后兼容性的原因,我们的代码仅限于使用 Java 2 语言级别和 JDK 1.3 库。 现在我们正在开发一个主要的新版本,并最终能够使用 Ja
此问题涉及当 saga 数据保留在 Azure 表存储中时对 saga 数据的并发访问。它也是在 Prefer 的文档中找到的引用信息:http://docs.particular.net/nserv
我有一个创建锁的方法。 ReadWriteLock lock = new ReentrantReadWriteLock(); 然后我使用 Lock Interface 将该对象传递到一个方法中。 m
当我在 Mac OSX 命令行上的 python 中执行以下操作时: >>> from concurrent.futures import ProcessPoolExecutor 我明白了 Modul
我正在 listview 的线程池上创建异步任务。我正在通过 asynchtask 的 listarray 处理这些任务。当 fragment 被销毁时我必须删除这些任务,并且当我在销毁最后一个 fr
我是一名优秀的程序员,十分优秀!