I'm trying to write modular Ionic1.x app. I was going to compile & concat & minify javascript and scss files.
However, when I use minify function at compress task, I got following error on sass task.
Muhammets-MacBook-Pro-3:x-app MmtBkn$ gulp
[01:00:29] Using gulpfile ~/Documents/Projects/x-app/gulpfile.js
[01:00:29] Starting 'sass'...
[01:00:29] Starting 'compress'...
[01:00:29] Finished 'compress' after 3.22 ms
[01:00:29] Starting 'watch'...
[01:00:29] Finished 'watch' after 9.32 ms
<--- Last few GCs --->
181117 ms: Scavenge 1386.3 (1457.2) -> 1386.3 (1457.2) MB, 0.3 / 0 ms (+ 0.7 ms in 1 steps since last GC) [allocation failure] [incremental marking delaying mark-sweep].
182315 ms: Mark-sweep 1386.3 (1457.2) -> 1261.2 (1457.2) MB, 1197.8 / 0 ms (+ 1.6 ms in 2 steps since start of marking, biggest step 0.9 ms) [last resort gc].
183817 ms: Mark-sweep 1261.2 (1457.2) -> 1261.2 (1457.2) MB, 1501.7 / 0 ms [last resort gc].
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x2e01223e3ac1 <JS Object>
2: /* anonymous */(aka /* anonymous */) [0x2e0122304189 <undefined>:~5007] [pc=0x39378c3457ff] (this=0x2e0122304189 <undefined>,self=0x531caddf789 <an AST_Number with map 0x29489836add9>,output=0x38677a93b4f1 <an Object with map 0x29489836c959>)
3: doit(aka doit) [0x2e0122304189 <undefined>:4197] [pc=0x39378c24c878] (this=0x2e0122304189 <undefined>)
4: print [0x2e0122304189 <undefin...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
Abort trap: 6
Yes, I don't know how or why but, when I comment minify lines which is at compress task, sass works well. I tried to re install packages, setup new project etc. nothing changes. Here is gulpfile.js
var gulp = require('gulp');
var gutil = require('gulp-util');
var bower = require('bower');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var sh = require('shelljs');
var minify = require('gulp-minify');
var paths = {
sass: ['./scss/**/*.scss']
};
gulp.task('serve:before', ['default','watch']);
gulp.task('default', ['sass','compress','watch']);
gulp.task('sass', function(done) {
gulp.src(['./scss/ionic.app.scss','./www/app/**/*.scss'])
.pipe(sass())
.on('error', sass.logError)
.pipe(concat('app.css'))
.pipe(minifyCss())
.pipe(gulp.dest('./www'))
.on('end', done);
});
gulp.task('compress', function() {
gulp.src('./www/**/*.js')
.pipe(concat('app.js'))
.pipe(minify({
ext:{
src:'-debug.js',
min:'.js'
},
exclude: ['./www/lib'],
ignoreFiles: ['.combo.js', '-min.js']
}))
.pipe(gulp.dest('./www'))
});
My OS version is OS X El Capitan with more than enough memory.
Package versions are
"gulp": "^3.5.6",
"gulp-sass": "^2.0.4",
"gulp-concat": "^2.2.0",
"gulp-minify-css": "^0.3.0",
"gulp-minify":"0.0.14",
"gulp-rename": "^1.2.0"
Any idea? Thank you.
Related
I am using yocto to build an image for the Up-Board following this guide: https://github.com/AaeonCM/meta-up-board
I tried to use Toaster for this project but later found out that the Up-Board isn't supported by toaster.
After I ran source toaster start I was no longer able to build form the command line with bitbake.
I get an error when I try to add an existing project by build directory in toaster, I think this is because the board is not supported.
The error I get when I try to use the 'Import command line project' feature in Toaster web browser is:
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/toastergui/newproject/
Django Version: 2.2.27
Python Version: 3.6.9
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.messages',
'django.contrib.sessions',
'django.contrib.admin',
'django.contrib.staticfiles',
'django.contrib.humanize',
'bldcollector',
'toastermain',
'bldcontrol',
'toastergui',
'orm')
Installed Middleware:
['django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware']
Traceback:
File "/home/dave/.local/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)
File "/home/dave/.local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
115. response = self.process_exception_by_middleware(e, request)
File "/home/dave/.local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
113. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/media/drive2/yocto2/poky/bitbake/lib/toaster/toastergui/views.py" in newproject
1407. management.call_command('buildimport', '--command=import', '--name=%s' % request.POST['projectname'], '--path=%s' % request.POST['importdir'], interactive=False)
File "/home/dave/.local/lib/python3.6/site-packages/django/core/management/__init__.py" in call_command
140. ', '.join(sorted(valid_options)),
Exception Type: TypeError at /toastergui/newproject/
Exception Value: Unknown option(s) for buildimport command: interactive. Valid options are: callback, command, delete_project, force_color, help, name, no_color, path, pythonpath, release, settings, skip_checks, stderr, stdout, traceback, verbosity, version.
The error I get when I try to build my project again from the command line is:
/poky/build$ MACHINE=up-board bitbake upboard-image-sato
Loading cache: 100% |#####################################################################################################################################################################| Time: 0:00:00
Loaded 3393 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies
Build Configuration:
BB_VERSION = "1.46.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "universal"
TARGET_SYS = "x86_64-poky-linux"
MACHINE = "up-board"
DISTRO = "poky"
DISTRO_VERSION = "3.1.14"
TUNE_FEATURES = "m64 corei7"
TARGET_FPU = ""
meta
meta-poky
meta-yocto-bsp = "dunfell:c8987e7bca6ab22a166ca13c5d2fe8e02fbb6e23"
meta-intel = "dunfell:8eec569734cb1ff9c0905f4a88f9b4bfc89ed9fc"
meta-up-board = "dunfell:23b0e460c068db2c69d844681a23b8febe9b95a0"
meta-oe
meta-python
meta-networking
meta-filesystems = "dunfell:ec978232732edbdd875ac367b5a9c04b881f2e19"
meta-virtualization = "dunfell:c5f61e547b90aa8058cf816f00902afed9c96f72"
Initialising tasks: 100% |################################################################################################################################################################| Time: 0:00:04
Sstate summary: Wanted 2 Found 0 Missed 2 Current 3705 (0% match, 99% complete)
NOTE: Executing Tasks
NOTE: Tasks Summary: Attempted 9002 tasks of which 9002 didn't need to be rerun and all succeeded.
ERROR: Execution of event handler 'toaster_buildhistory_dump' failed
Traceback (most recent call last):
File "/media/drive2/yocto2/poky/meta/classes/toaster.bbclass", line 273, in toaster_buildhistory_dump(e=<bb.event.BuildCompleted object at 0x7fe8e830f6d8>):
files[target]['files'] = []
> with open("%s/installed-package-sizes.txt" % installed_img_path, "r") as fin:
for line in fin:
FileNotFoundError: [Errno 2] No such file or directory: '/media/drive2/yocto2/poky/build/buildhistory/images/up_board/glibc/upboard-image-sato/installed-package-sizes.txt'
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
Is there any way to un-do whatever changes toaster did to the project? Uninstall toaster? Or should I start the project over again?
I am trying to debug the code below with vscode, but an error occurs.
Development environment
Microsoft Windows 10 Home 10.0.19042 Build 19042
rustc 1.49.0 (e1884a8e3 2020-12-29)
Vscode 1.54.3
CodeLLDB v1.6.1
// Cargo.toml
//[dependencies]
//datafusion = "3.0.0"
//arrow = "3.0.0"
//tokio = { version = "0.2", features = ["macros", "blocking", "rt-core", "rt-threaded", "sync"] }
use std::time::{Duration, Instant};
use arrow::util::pretty;
use datafusion::error::Result;
use datafusion::prelude::*;
/// This example demonstrates executing a simple query against an Arrow data source (CSV) and
/// fetching results
#[tokio::main]
async fn main() -> Result<()> {
println!("======== Start Program ========");
let start = Instant::now();
// let res_path = r"/root/workspace/project/hello_arrow/res/sample_01.csv";
// http://insideairbnb.com/get-the-data.html
// listing_id,id,date,reviewer_id,reviewer_name,comments
// Boston, Massachusetts, United States
let res_path = r"D:\workspace\vscode\arrow_rust\res\review.01.csv";
// create local execution context
let mut ctx = ExecutionContext::new();
// register csv file with the execution context
ctx.register_csv("datatable_01", res_path, CsvReadOptions::new())?;
// execute the query
let sql = "SELECT count(id) from datatable_01";
let df = ctx.sql(sql)?;
let results = df.collect().await?;
// print the results
pretty::print_batches(&results)?;
let duration = start.elapsed();
println!("Time elapsed in expensive_function() is: {:?}", duration);
println!("======== End Program ========");
Ok(())
}
Error Code
configuration: {
type: 'lldb',
request: 'launch',
name: 'Debug Window',
program: '${workspaceRoot}/target/debug/arrow_rust.exe',
args: [],
cwd: '${workspaceRoot}',
sourceLanguages: [ 'rust' ],
__configurationTarget: 5,
relativePathBase: 'd:\\workspace\\vscode\\arrow_rust'
}
Listening on port 8541
error: arrow_rust.exe :: Class 'arrow::datatypes::DataType' has a member '__0' of type 'alloc::vec::Vec<arrow::datatypes::Field>' which does not have a complete definition.
Debug adapter exit code=3221225620, signal=null.
The program runs normally. Debugging fine on Linux for the same code.
Is there any other way to debug on Windows?
I have the same problem.
Inspired by the link below, I have solved it.
https://github.com/vadimcn/vscode-lldb/issues/410#issuecomment-786791796
The reason is that I have installed NVIDIA Nsight.
As shown below, the msdia140.dll for Nsight has been loaded by codelldb.
Run PowerShell as administrator. Execute the command below to register the component. Then codelldb works.
regsvr32.exe C:\Users\【user name】\.vscode\extensions\vadimcn.vscode-lldb-1.6.8\lldb\bin\msdia140.dll
Update
For newer versions, the DLL has moved to another folder:
regsvr32.exe C:\Users\[user name]\.vscode\extensions\vadimcn.vscode-lldb-1.8.1\adapter\msdia140.dll
I am trying to view an app via "ionic serve" but I get this error. I have looked at other subjects but have never seen a runtime error. I tried all of their solutions but I would still have the same error page. Here is what I see:
And to be honest, I am not the coder of this app, but I have bought it from a store. But, I know some here and there. If there is a simple solution to fix this, that would be amazing!
The first error link is pointing to here:
_this.initialData();
var operating_system = '';
var admob = {};
if (_this.device.platform.toLowerCase() == 'android') {
operating_system = 'android';
admob = {
banner: settings['admob_android_banner'],
interstitial: settings['admob_android_interstitial']
};
}
The second error link is pointing me to here:
SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {
try {
fn.call(this._context, value);
}
catch (err) {
this.unsubscribe();
throw err;
}
};
The third error is pointing to here:
SafeSubscriber.prototype.next = function (value) {
if (!this.isStopped && this._next) {
var _parentSubscriber = this._parentSubscriber;
if (!_parentSubscriber.syncErrorThrowable) {
this.__tryOrUnsub(this._next, value);
}
else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
this.unsubscribe();
}
}
The fourth error is pointing to here:
Subscriber.prototype._next = function (value) {
this.destination.next(value);
};
The fifth error is pointing to here:
var /** #type {?} */ response = new Response(responseOptions);
response.ok = isSuccess(status);
if (response.ok) {
responseObserver.next(response);
// TODO(gdi2290): defer complete if array buffer until done
responseObserver.complete();
return;
}
Here is the code I get in cmd:
C:\Users\xx-nj\Desktop\DukhanApp\DukhanColor>ionic serve
Starting app-scripts server: --address 0.0.0.0 --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser -
Ctrl+C to cancel
[20:02:52] watch started ...
[20:02:52] build dev started ...
[20:02:53] clean started ...
[20:02:53] clean finished in 3 ms
[20:02:53] copy started ...
[20:02:53] deeplinks started ...
[20:02:53] deeplinks finished in 573 ms
[20:02:53] transpile started ...
[20:03:01] transpile finished in 7.70 s
[20:03:01] preprocess started ...
[20:03:01] preprocess finished in 1 ms
[20:03:01] webpack started ...
[20:03:01] copy finished in 8.80 s
[20:03:09] webpack finished in 8.01 s
[20:03:09] sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[20:03:13] sass finished in 3.39 s
[20:03:13] postprocess started ...
[20:03:13] postprocess finished in 14 ms
[20:03:13] lint started ...
[20:03:13] build dev finished in 20.14 s
[20:03:13] watch ready in 20.44 s
[20:03:13] dev server running: http://localhost:8100/
[OK] Development server running!
Local: http://localhost:8100
External: http://192.168.8.111:8100
DevApp: celltore_ionic3#8100 on NajmLaptop
[20:03:23] tslint: C:/Users/xx-nj/Desktop/DukhanApp/DukhanColor/src/pages/contactus/contactus.ts, line: 124
'marker' is declared but never used.
L123: let map = new google.maps.Map(element, mapOptions);
L124: let marker = new google.maps.Marker({
L125: title: this.textStatic['cellstore_contact_us_title'],
[20:03:23] tslint: ...s/xx-nj/Desktop/DukhanApp/DukhanColor/src/pages/detailcategory/detailcategory.ts, line: 138
Duplicate variable: 'filter'
L138: for (var filter in this.filter['valueCustom']) {
L139: let attr = this.filter['value'][filter];
[20:03:23] tslint: ...s/xx-nj/Desktop/DukhanApp/DukhanColor/src/pages/detailcategory/detailcategory.ts, line: 140
Duplicate variable: 'option'
L139: let attr = this.filter['value'][filter];
L140: if (attr && Object.keys(attr).length > 0) for (var option in attr) {
L141: if(option != 'select' && attr[option]) {
[20:03:23] tslint: C:/Users/xx-nj/Desktop/DukhanApp/DukhanColor/src/pages/brand/brand.ts, line: 121
Duplicate variable: 'filter'
L121: for (var filter in this.filter['valueCustom']) {
L122: let attr = this.filter['value'][filter];
[20:03:23] tslint: C:/Users/xx-nj/Desktop/DukhanApp/DukhanColor/src/pages/brand/brand.ts, line: 123
Duplicate variable: 'option'
L122: let attr = this.filter['value'][filter];
L123: if (attr && Object.keys(attr).length > 0) for (var option in attr) {
L124: if(option != 'select' && attr[option]) {
[20:03:23] tslint: C:/Users/xx-nj/Desktop/DukhanApp/DukhanColor/src/pages/home/home.ts, line: 300
Duplicate variable: 'diff'
L299: element[i]["due_date"] = false;
L300: var diff = (start.getTime() - today.getTime()) / 1000;
L301: element[i]['time_diff'] = Math.floor(diff);
[20:03:23] tslint: C:/Users/xx-nj/Desktop/DukhanApp/DukhanColor/src/pages/home/home.ts, line: 165
'remaining_time' is declared but never used.
L164: ngOnInit() {
L165: var remaining_time = setInterval(() => {
L166: if (this.navCtrl.getActive().component.name == "HomePage") {
[20:03:23] tslint: C:/Users/xx-nj/Desktop/DukhanApp/DukhanColor/src/pages/search/search.ts, line: 213
Duplicate variable: 'filter'
L213: for (var filter in this.filter['valueCustom']) {
L214: let attr = this.filter['value'][filter];
[20:03:23] tslint: C:/Users/xx-nj/Desktop/DukhanApp/DukhanColor/src/pages/search/search.ts, line: 215
Duplicate variable: 'option'
L214: let attr = this.filter['value'][filter];
L215: if (attr && Object.keys(attr).length > 0) for (var option in attr) {
L216: if(option != 'select' && attr[option]) {
[20:03:23] lint finished in 10.05 s
It seems that platform is not returned properly and that's why it's null.
You didn't include your constructor so i have no idea how your constructor looks like, but the following code snippet is returning platform name properly using the Device plugin you're using in your code.
import { Device } from '#ionic-native/device';
constructor(private device: Device) {}
......
if(this.device.platform.toLowerCase()=='android'){
// Your logic here
}
This happens because you're running ionic serve on web and the cordova platform isn't available there. Ionic Native returns {} when a property doesn't exist (when cordova isn't available), and it throws a console warning for developer assistance.
When one try to retrieve data from {} object then it will return null.
Please try adding below code:
import { Platform } from 'ionic-angular';
//add it in constructor as follows:
constructor( public platform: Platform){
}
//add platform check
if (this.platform.is('cordova')) {
//add your code here
}else{
console.log("Plugin not supported on web");
}
I am trying to use Protractor for our application. Unfortunately, the initial login page is non-Angular so I'm having to handle all the implicit waits with ExpectedConditions. In the below code snippet, the click() is never executed. Instead, the test times out waiting for the next page to show. In the console output (also pasted below) I see the the link was found, but I don't see the subsequent click action.
var signUpLink = element(by.id('sign-up-link'));
var isLinkClickable = EC.elementToBeClickable(signUpLink);
browser.wait(isLinkClickable, 5000).then(function() {
signUpLink.click();
});
var isWidgetVisible = EC.visibilityOf(element(by.id('email')));
browser.wait(isWidgetVisible, 5000, 'Sign Up Page is too slow');
Here's a snippet of the console output:
12:54:17.404 INFO - Executing: [find elements: By.id: sign-up-link])
12:54:18.002 INFO - Done: [find elements: By.id: sign-up-link]
12:54:18.006 INFO - Executing: [is enabled: 0 [[ChromeDriver: chrome on MAC ()] -> id: sign-up-link]])
12:54:18.141 INFO - Done: [is enabled: 0 [[ChromeDriver: chrome on MAC ()] -> id: sign-up-link]]
12:54:18.147 INFO - Executing: [find elements: By.id: sign-up-link])
12:54:18.755 INFO - Done: [find elements: By.id: sign-up-link]
12:54:18.760 INFO - Executing: [is displayed: 0 [[ChromeDriver: chrome on MAC ()] -> id: sign-up-link]])
12:54:18.770 INFO - Done: [is displayed: 0 [[ChromeDriver: chrome on MAC ()] -> id: sign-up-link]]
12:54:18.774 INFO - Executing: [find elements: By.id: sign-up-link])
12:54:18.780 INFO - Done: [find elements: By.id: sign-up-link]
12:54:18.787 INFO - Executing: [is enabled: 0 [[ChromeDriver: chrome on MAC ()] -> id: sign-up-link]])
12:54:18.791 INFO - Done: [is enabled: 0 [[ChromeDriver: chrome on MAC ()] -> id: sign-up-link]]
12:54:18.805 INFO - Executing: [find elements: By.id: email])
12:54:18.815 INFO - Done: [find elements: By.id: email]
Edit - 5/10
I got it to work by adding an explicit wait (gasp!). I don't get why this works. Why does it take so long for the link to get clicked?
var signUpLink = element(by.id('sign-up-link'));
var isLinkClickable = EC.elementToBeClickable(signUpLink);
browser.wait(isLinkClickable, 5000);
browser.driver.sleep(3000); // I give up
signUpLink.click();
My best guess based on what you've shared is that the link becomes clickable while elements above it in the DOM are still rendering. The end result is that the wait condition is satisfied, a click event is scheduled, but before the click can occur new elements are rendered that shift the link elsewhere so that the click doesn't actually hit the link. It sounds far-fetched I know, but I saw something similar happen with webdriver-jvm on a project I was working on. On my project I was lucky enough to have jQuery loaded in the page, so I fixed my problem by executing a $(window).load(); using a JavascriptExecutor before trying to click the button, which ensured that the page was entirely loaded before webdriver continued it's execution. You could try doing something similar if you happen to have jQuery loaded up:
browser.driver.executeScript('$(window).load();').then(function() {
var signUpLink = element(by.id('sign-up-link'));
var isLinkClickable = EC.elementToBeClickable(signUpLink);
browser.wait(isLinkClickable, 5000).then(function() {
signUpLink.click();
});
var isWidgetVisible = EC.visibilityOf(element(by.id('email')));
browser.wait(isWidgetVisible, 5000, 'Sign Up Page is too slow');
});
I'm writing a (ever larger) set of unit tests using Coffeescript and node.js. I build the files using the coffee "watch" option (-w)
coffee -w -b -c -o web/ src/
My problem is that running the unit tests takes 20 secs (I'm assuming for the compile to .js).
If possible, I'd like automatically run the unit tests on a (compiled .js) file change, which would eliminate the long wait for the results.
My current Cakefile:
fs = require 'fs'
{print} = require 'sys'
{spawn, exec} = require 'child_process'
build = (watch, callback) ->
if typeof watch is 'function'
callback = watch
watch = false
options = ['-c', '-b', '-o', 'web', 'src']
options.unshift '-w' if watch
coffee = spawn 'coffee', options
coffee.stdout.on 'data', (data) -> print data.toString()
coffee.stderr.on 'data', (data) -> print data.toString()
coffee.on 'exit', (status) -> callback?() if status is 0
task 'test', 'Run the test suite', ->
build ->
require.paths.unshift __dirname + "/lib"
{reporters} = require 'nodeunit'
process.chdir __dirname
reporters.default.run ['test']
Take a look at the Cakefile for my connect-assets project: https://github.com/adunkman/connect-assets/blob/master/Cakefile
It's a bit more complex than sstephenson's (which I assume your example is derived from), but it shows how you can watch a directory of files for changes and respond to those changes by re-running tests.