Nativescript - tns create test app errors - javascript

I created a test app with "tns create test" but it errors when I try to run it. Error: "Unfortunately, test app has stopped."
Please advice what I'm missing!
Thanks in advance,
ami
--
Error log:
https://www.dropbox.com/s/9mf26a8hdwcl3b4/Screenshot%202016-06-06%2022.41.48.png?dl=0
Test app code:
https://www.dropbox.com/sh/k8lkwoulh0k34ij/AAC7yTnMWIvGhWAF8lBQeUvra?dl=0
Command Logs:
# Ubuntu 16 LTS
# NODE, TNS, JAVA, ANDROID installed with: https://github.com/nraboy/ubuntu-nativescript-installer/blob/master/ubuntu_nativescript_installer.sh
dev#farm:~/test$ env
ANDROID_HOME=/opt/android-sdk
SHELL=/bin/bash
TERM=xterm
USER=dev
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin:/opt/node/bin:/opt/android-sdk/tools:/opt/android-sdk/platform-tools:/opt/genymobile/genymotion
PWD=/home/dev/test
JAVA_HOME=/usr/lib/jvm/default-java
NODE_HOME=/opt/node
......
dev#farm:~/test$ node --version
v4.4.5
dev#farm:~/test$ tns --version
2.0.1
dev#farm:~$ tns create test
Project test was successfully created.
dev#farm:~$ cd test
/home/dev/test
dev#farm:~/test$ tns install babel && tns platform add android
-
> nativescript-dev-babel#0.1.6 postinstall /home/dev/test/node_modules/nativescript-dev-babel
> node postinstall.js
babel-core#6.9.1 node_modules/babel-core
babel-messages#6.8.0
path-is-absolute#1.0.0
slash#1.0.0
babel-template#6.9.0
shebang-regex#1.0.0
path-exists#1.0.0
babel-helpers#6.8.0
private#0.1.6
convert-source-map#1.2.0
source-map#0.5.6
babylon#6.8.1
minimatch#2.0.10 (brace-expansion#1.1.4)
debug#2.2.0 (ms#0.7.1)
babel-types#6.9.1 (to-fast-properties#1.0.2, esutils#2.0.2)
babel-code-frame#6.8.0 (js-tokens#1.0.3, esutils#2.0.2, chalk#1.1.3)
babel-traverse#6.9.0 (globals#8.18.0, invariant#2.2.1)
json5#0.4.0
babel-generator#6.9.0 (detect-indent#3.0.1)
lodash#4.13.1
babel-register#6.9.0 (mkdirp#0.5.1, home-or-tmp#1.0.0, source-map-support#0.2.10, core-js#2.4.0)
babel-runtime#6.9.2 (regenerator-runtime#0.9.5, core-js#2.4.0)
nativescript-dev-babel#0.1.6 node_modules/nativescript-dev-babel
minimatch#3.0.0 (brace-expansion#1.1.4)
glob#5.0.15 (path-is-absolute#1.0.0, inherits#2.0.1, inflight#1.0.5, once#1.3.3)
nativescript-hook#0.2.1 (glob#6.0.4, mkdirp#0.5.1)
Copying template files...
\u25e1 Installing tns-androidbabel-traverse#6.9.0 node_modules/babel-traverse
babel-messages#6.8.0
globals#8.18.0
babylon#6.8.1
debug#2.2.0 (ms#0.7.1)
babel-types#6.9.1 (to-fast-properties#1.0.2, esutils#2.0.2)
invariant#2.2.1 (loose-envify#1.2.0)
babel-code-frame#6.8.0 (js-tokens#1.0.3, esutils#2.0.2, chalk#1.1.3)
lodash#4.13.1
babel-runtime#6.9.2 (regenerator-runtime#0.9.5, core-js#2.4.0)
Installing tns-androidbabel-types#6.9.1 node_modules/babel-types
to-fast-properties#1.0.2
esutils#2.0.2
lodash#4.13.1
babel-runtime#6.9.2 (regenerator-runtime#0.9.5, core-js#2.4.0)
Installing tns-androidbabylon#6.8.1 node_modules/babylon
babel-runtime#6.9.2 (regenerator-runtime#0.9.5, core-js#2.4.0)
Installing tns-androidfilewalker#0.1.2 node_modules/filewalker
fqueue#0.0.0
Installing tns-androidlazy#1.0.11 node_modules/lazy
Project successfully created.
dev#farm:~/test$ tns livesync android --watch --geny nexus5-emug
Successfully prepared plugin tns-core-modules for android.
Successfully prepared plugin tns-core-modules-widgets for android.
Project successfully prepared
Executing after-prepare hook from /home/dev/test/hooks/after-prepare/nativescript-dev-babel.js
Processing complete
Transferring project files...
Successfully transferred all project files.
Applying changes...
Successfully synced application org.nativescript.test on device 192.168.57.101:5555.
06-09 00:10:11.445 105 105 F DEBUG : #11 pc 00553d83 /data/app/org.nativescript.test-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::CompileIrregexp(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, bool)+675)
06-09 00:10:11.445 105 105 F DEBUG : #12 pc 00553fd5 /data/app/org.nativescript.test-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::IrregexpPrepare(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>)+165)
06-09 00:10:11.445 105 105 F DEBUG : #13 pc 005544f3 /data/app/org.nativescript.test-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::IrregexpExec(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, int, v8::internal::Handle<v8::internal::JSArray>)+51)
06-09 00:10:11.445 105 105 F DEBUG : #14 pc 005546a0 /data/app/org.nativescript.test-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::Exec(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, int, v8::internal::Handle<v8::internal::JSArray>)+144)
Error! I uninstall app from geny and try this:
dev#farm:~/test$ tns platform remove android
Platform android successfully removed.
dev#farm:~/test$ tns platform add android
Copying template files...
Project successfully created.
dev#farm:~/test$ tns run android --watch --geny nexus5-emug
Successfully prepared plugin tns-core-modules for android.
Successfully prepared plugin tns-core-modules-widgets for android.
Project successfully prepared
Executing after-prepare hook from /home/dev/test/hooks/after-prepare/nativescript-dev-babel.js
Processing complete
:config phase: createDefaultIncludeFiles
+found plugins: tns-core-modules-widgets
+ creating include.gradle file for /home/dev/test/platforms/android/configurations/tns-core-modules-widgets
Renaming plugin directory to flavor name: /home/dev/test/platforms/android/src/tns-core-modules-widgets -> /home/dev/test/platforms/android/src/F0
:config phase: createPluginsConfigFile
Creating product flavors include.gradle file in /home/dev/test/platforms/android/configurations folder...
:config phase: pluginExtend
+applying configuration from: /home/dev/test/platforms/android/configurations/tns-core-modules-widgets/include.gradle
+applying configuration from: /home/dev/test/platforms/android/configurations/include.gradle
:config phase: copyAarDependencies
:config phase: addAarDependencies
+adding dependency: /home/dev/test/platforms/android/libs/aar/widgets-release.aar
:preBuild UP-TO-DATE
:preF0DebugBuild UP-TO-DATE
:checkF0DebugManifest
:preF0ReleaseBuild UP-TO-DATE
:prepareComAndroidSupportAnimatedVectorDrawable2340Library
:prepareComAndroidSupportAppcompatV72340Library
:prepareComAndroidSupportSupportV42340Library
:prepareComAndroidSupportSupportVectorDrawable2340Library
:prepareWidgetsReleaseLibrary
:prepareF0DebugDependencies
:compileF0DebugAidl
:compileF0DebugRenderscript
:generateF0DebugBuildConfig
:cleanLocalAarFiles
:ensureMetadataOutDir
:collectAllJars
:setProperties
:asbg:generateInterfaceNamesList
:asbg:runAstParser
couldn't find logDirectory so it will be created in place:/home/dev/test/platforms/android/build-tools/android-static-binding-generator/ast-parser/logs/i.txt
inputDir: /home/dev/test/platforms/android/src/main/assets/app
outFile: ../bindings.txt
:asbg:generateBindings
:generateF0DebugAssets UP-TO-DATE
:mergeF0DebugAssets
:generateF0DebugResValues
:generateF0DebugResources
:mergeF0DebugResources
:processF0DebugManifest
:processF0DebugResources
:generateF0DebugSources
:compileF0DebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:compileF0DebugNdk UP-TO-DATE
:compileF0DebugSources
:buildMetadata
'assets/metadata/treeNodeStream.dat' NOT FOUND
'assets/metadata/treeStringsStream.dat' NOT FOUND
'assets/metadata/treeValueStream.dat' NOT FOUND
'assets/metadata/treeNodeStream.dat'...
'assets/metadata/treeStringsStream.dat'...
'assets/metadata/treeValueStream.dat'...
:transformClassesWithDexForF0Debug
:mergeF0DebugJniLibFolders
:transformNative_libsWithMergeJniLibsForF0Debug
:processF0DebugJavaRes UP-TO-DATE
:transformResourcesWithMergeJavaResForF0Debug
:validateDebugSigning
:packageF0Debug
:zipalignF0Debug
:assembleF0Debug
:assembleDebug
:deleteExplodedAarFolder
:buildapk
BUILD SUCCESSFUL
Total time: 39.405 secs
This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.8/userguide/gradle_daemon.html
Project successfully built
Successfully deployed on device with identifier '192.168.57.101:5555'.
06-09 11:29:39.549 105 105 F DEBUG : #11 pc 00553d83 /data/app/org.nativescript.test-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::CompileIrregexp(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, bool)+675)
06-09 11:29:39.549 105 105 F DEBUG : #12 pc 00553fd5 /data/app/org.nativescript.test-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::IrregexpPrepare(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>)+165)
06-09 11:29:39.549 105 105 F DEBUG : #13 pc 005544f3 /data/app/org.nativescript.test-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::IrregexpExec(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, int, v8::internal::Handle<v8::internal::JSArray>)+51)
06-09 11:29:39.549 105 105 F DEBUG : #14 pc 005546a0 /data/app/org.nativescript.test-1/lib/x86/libNativeScript.so (v8::internal::RegExpImpl::Exec(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, int, v8::internal::Handle<v8::internal::JSArray>)+144)
Error!

In your rootFolder/platforms/android you have a build.gradle file :
In this file (which is generated) you should have a "defaultConfig" property which might look like this :
android {
...
defaultConfig {
minSdkVersion 17
targetSdkVersion computeTargetSdkVersion()
}
...
}
Update this code and add an "applicationId" property
defaultConfig {
minSdkVersion 17
targetSdkVersion computeTargetSdkVersion()
applicationId "com.stackoverflow.yourpackage"
}
By the way , this is how i fixed this but i have no idea why this generated file needs to be manually updated

Related

WebUSB: device.open() on any device causing "Failed to execute 'open' on 'USBDevice': Access denied"

I'm playing with a thermal printer to work with WebUSB.
Here is the minimal Glitch demo (please note this demo may show your connected usb devices):
preview: https://canary-adjoining-garlic.glitch.me
code: https://glitch.com/edit/#!/canary-adjoining-garlic
I'm able to select the (any) device. But unable to call device.open().
document.getElementById("print-button-usb").addEventListener("click", () => {
console.log('clicked');
navigator.usb.requestDevice({ filters: [] })
.then(device => {
console.log('device paired', device);
console.log(device.vendorId, typeof device.vendorId);
return device;
})
.then(device => device.open()) // Error here <<-------------------------------------!
.catch(err => console.error("my err", err));
})
Not only that printer, but I'm unable to open any connected shown devices. Can someone point out what am I missing here?
Environment details:
Ubuntu 22.04.1
Chrome Version 107.0.5304.121
I've been following this guide: https://web.dev/usb
Update : (Debug informations)
My chrome://device-log says: Failed to open /dev/bus/usb/001/005: Permission denied (13). I tried to cat that node:
$ cat /dev/bus/usb/001/005
#V �2 �##%
$ pwd
/dev/bus/usb/001
$ ls -l
total 0
crw-rw-r-- 1 root root 189, 0 Nov 30 23:13 001
crw-rw-r-- 1 root root 189, 1 Nov 30 23:13 002
crw-rw-r-- 1 root root 189, 2 Nov 30 23:13 003
crw-rw-r-- 1 root root 189, 3 Nov 30 23:13 004
crw-rw-r-- 1 root lp 189, 4 Dec 1 00:07 005
In the above image,
Integrated_Webcam_HD: laptop camera
KT USB Audio: my headphones connected via usb-c
CB-GK-16 Firefly: Additional keyboard
USB Portable Printer: the thermal printer I'm playing with
I tried to connect my phone over usb and tried to pair - I was able to pair it.
In this list, the "Pixel 3" device was the only device I was able to successfully connect. All others are returning the "Access Denied" error.
Same problem here using FTDI device.
I was able to get the device but not I could not open it with exactly the same error. I was using windows 10 by the way. Problem was solved by changing the driver from FTDI custom driver to WinUsb using zadig.
note:
after doing so, the device could not be used by the previous .NET application and it is only accessible by the browser.

Get real architecture of M1 Mac regardless of Rosetta

I need to retrieve the real architecture of a Mac regardless of if the process is running through Rosetta or not.
Right now in Node.js, process.arch returns x64 and in shell, uname -m returns x86_64.
Thanks to #Ouroborus, this note describes how to figure out if your app is translated.
If it's translated:
$ sysctl sysctl.proc_translated
sysctl.proc_translated: 1
If not:
$ sysctl sysctl.proc_translated
sysctl.proc_translated: 0
On non-ARM Macs:
$ sysctl sysctl.proc_translated
sysctl: unknown oid 'sysctl.proc_translated'
As #Elmo's answer indicates, the command line sysctl -n sysctl.proc_translated or the native equivalent sysctlbyname() call will indicate whether you are running under Rosetta.
Two other sysctl values are relevant. On M1 hardware without Rosetta, these values are returned:
hw.cputype: 16777228
hw.cpufamily: 458787763
hw.cputype is 0x0100000C (CPU_TYPE_ARM64) and hw.cpufamily is 0x1b588bb3 (CPUFAMILY_ARM_FIRESTORM_ICESTORM).
However, when executed under Rosetta, the low-level machine code which collects CPUID takes precendence and following two values are returned, both via sysctlbyname() and the command line:
hw.cputype: 7
hw.cpufamily: 1463508716
These correspond to 0x7 (CPU_TYPE_X86) and 0x573b5eec (INTEL_WESTMERE).
It appears Rosetta reports an x86-compatible Westmere chip under Rosetta, but this choice seems consistent everywhere I've seen. This "virtual architecture" may be useful information for some programs.
Another possibility presents itself in the IO Registry. While the default IOService plane collects data in real-time, the IODeviceTree plane is stored at boot, and includes these entries in the tree (command line ioreg -p IODeviceTree or ioreg -c IOPlatformDevice):
cpu0#0 <class IOPlatformDevice, id 0x10000010f, registered, matched, active, busy 0 (180 ms), retain 8>
| | | {
...
| | | "compatible" = <"apple,icestorm","ARM,v8">
(for CPUs 0-3)
and
cpu4#100 <class IOPlatformDevice, id 0x100000113, registered, matched, active, busy 0 (186 ms), retain 8>
| | | {
...
| | | "compatible" = <"apple,firestorm","ARM,v8">
(for CPUs 4-7)
This clearly indicates the ARMv8 Firestorm + Icestorm M1 chip.
The same approach should work for the M1 Pro and M1 Max.

Install OpenSSL for MSVC2017 on 64-bit Windows 10

.pro
LIBS += -LC:\Qt\Tools\OpenSSL\Win_x86\lib -llibssl
LIBS += -LC:\Qt\Tools\OpenSSL\Win_x86\lib -llibcrypto
INCLUDEPATH += C:\Qt\Tools\OpenSSL\Win_x86\include
main.qml
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.0
Window {
visible: true
width: 640
height: 480
Component.onCompleted: getPage(logResults)
function logResults(results) {
console.log("RESULTS: " + results)
}
function getPage(callback) {
var xhttp = new XMLHttpRequest();
var url = "https://www.google.com/"
xhttp.onreadystatechange = function() {
if (xhttp.readyState === 4 && xhttp.status === 200) {
console.log("calling callback")
callback(xhttp.responseText)
}
};
xhttp.open("GET", url);
xhttp.send();
}
}
expected output
qml: calling callback
qml: RESULTS: <html>
actual output
qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_ciphersuites
qt.network.ssl: QSslSocket: cannot resolve SSL_set_psk_use_session_callback
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_set_psk_use_session_callback
qml: calling callback
Windows 10 64-bit OS, running MSVC2017 QML project
I ran C:\Qt\MaintenanceTool.exe to install Developer and Designer Tools > OpenSSL 1.1.1d Toolkit
I've tried following a previous tutorial and another one for MSVC2017 but no luck in resolving the errors or getting xhttp.responseText. Found out the code works in ubuntu 19.4 so it just has to be that I'm running it on my windows machine that something funky is happening with the OpenSSL. I couldn't find any resolution by googling the outputted error messages. I've read that accidentally installing openSSL to "the windows directory" can cause errors, but I've not been able to actually locate "the windows directory" in question to check if I did.
edit
From C:\Qt\Tools\OpenSSL\Win_x64\bin I copied libcrypto-1_1-x64.dll and libssl-1_1-x64.dll to my project's \debug and \release folders. This removed the qt.network.ssl errors, however I am still not getting the expected output of qml: RESULTS: <html>
You ran C:\Qt\MaintenanceTool.exe to install Developer and Designer
Tools > OpenSSL 1.1.1d Toolkit
That is also my recommendation. The alternative is to compile OpenSSL yourself, or download a binary package from a third party provider. I have one of those packages installed at "C:\Program Files\OpenSSL-Win64\bin", and programs using Qt+=network are able to locate and load the libraries when their path is included in the PATH environment variable. The problem is that you will need to take care of the updates yourself, but the Qt packages are automatically updated with the MaintenanceTool along with Qt and Qt Creator. So pick your choice.
Anyway, even if you have another set of OpenSSL DLLs in your path, if you copy the libraries to the output directory of your executable, these libraries will be loaded instead. Two questions need to be answered here: 1) how do you copy the DLLs automatically each time they are needed?, and 2) how do you verify which DLLs are loaded when you run your program?
1) You may add the following to your project .pro:
win32 {
CONFIG += file_copies
CONFIG(debug, debug|release) {
openssllibs.path = $$OUT_PWD/debug
} else {
openssllibs.path = $$OUT_PWD/release
}
contains(QMAKE_TARGET.arch, x86_64) {
openssllibs.files = C:/Qt/Tools/OpenSSL/Win_x64/bin/libcrypto-1_1-x64.dll \
C:/Qt/Tools/OpenSSL/Win_x64/bin/libssl-1_1-x64.dll
} else {
openssllibs.files = C:/Qt/Tools/OpenSSL/Win_x86/bin/libcrypto-1_1.dll \
C:/Qt/Tools/OpenSSL/Win_x86/bin/libssl-1_1.dll
}
COPIES += openssllibs
}
That is it. Now your program will always have the latest libraries from Qt/Tools copied to the output directory of your project, without worrying if you compile in debug or release mode, or 32/64 bits, or another Qt Kit.
2) Run your program while inspecting the loaded DLLs with Process Explorer, by Mark Russinovich. To do so, in Process Explorer->View->Show lower pane, and select your running program in the upper pane. The lower pane lists all your loaded DLLs and origins. There are other similar utilities out there, like the open source Process Hacker.
Even understanding all of the above, and following exactly the recipe, your program still does not print the desired output. Please change the function logResults() in your qml like this:
function logResults(results) {
console.log("RESULTS Length=", results.length);
console.log("results.substr=", results.substr(0, 20));
}
You will get the following output:
qml: calling callback
qml: RESULTS Length= 47932
qml: results.substr= <!doctype html><html
Explanation: looks like console.log() has a limitation of about 32K in Windows (it doesn't on Linux). The document retrieved from the remote host is much larger, and this breaks the logging function. This is probably a bug in Qt (it should not fail silently like that).
Another advice for anybody coming here in the future: It is not strictly needed, but you may want to verify in your main() function that SSL is available, with something like this code:
#include <QDebug>
#include <QSslSocket>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
if (!QSslSocket::supportsSsl()) {
qDebug() << "Sorry, OpenSSL is not supported";
return -1;
}
qDebug() << "build-time OpenSSL version:" << QSslSocket::sslLibraryBuildVersionString();
qDebug() << "run-time OpenSSL version:" << QSslSocket::sslLibraryVersionString();
[...]
}

Gradle sync failed: Could not find kxml2.jar

I've encountered an error in my Gradle Log. It prevents my Android Studio App to deploy / do a Gradle sync.
Full Error Message:
Gradle sync failed: Could not find kxml2.jar (net.sf.kxml:kxml2:2.3.0).
Searched in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar
Consult IDE log for more details (Help | Show Log)
In this directory "C:/Program Files/Android/Android Studio/gradle/m2repository/net/sf/kxml/kxml2" is indeed no file named kxml2.jar.
Sloppily creating the file with no content, doesnt solve the Problem, expectedly.
And Google doesn't help me at all, so I need you help.
Elias
EDIT:
This is the full error Message from the idea.log:
2017-05-30 09:39:19,203 [ 145127] WARN - ect.sync.idea.ProjectSetUpTask -
2017-05-30 09:39:19,203 [ 145127] INFO - ect.sync.idea.ProjectSetUpTask - Could not find kxml2.jar (net.sf.kxml:kxml2:2.3.0).
Searched in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar
Consult IDE log for more details (Help | Show Log)
2017-05-30 09:39:19,203 [ 145127] INFO - e.project.sync.GradleSyncState - Sync with Gradle for project 'ShishaTobacco' failed: Could not find kxml2.jar (net.sf.kxml:kxml2:2.3.0).
Searched in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar
Consult IDE log for more details (Help | Show Log)
2017-05-30 09:39:19,252 [ 145176] INFO - #com.jetbrains.cidr.lang - Clearing symbols finished in 0 s.
2017-05-30 09:39:19,253 [ 145177] INFO - #com.jetbrains.cidr.lang - Loading symbols finished in 0 s.
2017-05-30 09:39:19,255 [ 145179] INFO - #com.jetbrains.cidr.lang - Building symbols finished in 0 s.
2017-05-30 09:39:19,255 [ 145179] INFO - #com.jetbrains.cidr.lang - Saving symbols finished in 0 s.
Edit 2:
I've just reinstalled Android Studio, now everything is working fine.

How to inspect result of `node --prof` on x64 MacOS X 10.7?

I try to profile my node.js script at CLI.
As written at https://code.google.com/p/v8/wiki/V8Profiler, or http://blog.arc90.com/2012/03/05/profiling-node-programs-on-mac-os-x/ a do:
$ node --prof my_script.js
All ok, I get file named v8.log with bunch of lines.
But then in inspection tools all go wrong.
$ tools/mac-tick-processor v8.log
show to me
Statistical profiling result from v8.log, (298 ticks, 237 unaccounted, 0 excluded).
and empty JavaScript section.
[JavaScript]:
ticks total nonlib name
Also I try https://github.com/bnoordhuis/node-profiler, but get some results too.
How I can work with --prof results?
$ node -v
v0.8.18
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.7.4
BuildVersion: 11E53
As suggested by #Dogbert you can use github.com/sidorares/node-tick
Feel free to create pull request if you missing any functionality. I haven't updated it for quite a while and it still seems to work
After Node 4.4.0:
node --prof-process isolate-0xnnnnnnnnnnnn-v8.log > processed.txt
From: https://nodejs.org/en/docs/guides/simple-profiling/

Categories

Resources