I am trying to use node-inspector debug a nodeJS app running with babel-node.
babel-node index.js --debug
Node-inspector works but it shows the source maps in the transpiled es5 instead of es6
For babel 6, I used the require hook.
Follow these instructions to get babel register. https://babeljs.io/docs/setup/#babel_register
In your app.js or entrypoint to the application add
require('babel-register')({
sourceMaps: true
});
If you need to add other options as well, see - https://babeljs.io/docs/usage/options/#options
You should be able to use node-inspector & chrome to to debug your application
According to the Tao of Javascript, "Code flows in the moment, so knowledge is but a hint, like the map of a stream."
The latest version of v8 now uses a command like:
$ babel-node --inspect --debug-brk a.js
For source maps, try adding this to a.js:
import 'source-map-support/register';
It needs a wrapper that will create the source map to the source code instead of the transpiled code.
From https://babeljs.io/docs/setup/#babel_node_debug
npm install -g babel-node-debug
babel-node-debug index.js
Update
Instead of running it with babel-node I transpile it to es5 + sourcemaps and then run it with node.
By doing that, node-inspector will show the proper code in the source dev tools.
I haven't figured out how to do it with babel-node
Related
I've used Electron standalone before, and console.log() commands in main.js worked just fine (output to IDE console) and the electron-reload module also worked fine when content changes were detected in the Electron root folder.
I've now started a new Ionic 5 project, and added Electron to the project via Capacitor. Capacitor makes a few necessary changes to Electron (e.g. renaming main.js to index.js etc), I've now also have to start electron via capacitor npx cap open electron.
In doing so, console.log() commands in index.js are now NOT being output to the IDE console, errors are not being output to console, and the electron-reload module now serves a blank page when changes are detected… the only console output that I get is:
$ npx cap open electron
[info] Opening Electron project at ...
Is this a capacitor limitation or what configurations must be done to make this work ?
#ionic/cli#6.10.0
#capacitor/core#2.2.0
electron#8.3.1
also updated electron to latest 9.0.4 - same result.
here are steps to reproduce this:
# install ionic CLI
$ npm install -g #ionic/cli
# create project w/ capacitor
$ ionic start <project name> blank --type=angular --capacitor
# create initial build, needed by cap for electron
$ cd <ionic_project_folder>
$ ionic build
# add electron via cap
$ npx cap add electron
# run electron
$ npx cap open electron
if you enter console.log messages in electron’s index.js, none of them will be logged…
figured it out. Capacitor blocks all log messages by default, but you can run npm run electron:start from within the /electron folder and you'll get all log messages... HTH someone.
I want show custom splash screen with animation. I tried add LottieSplashScreen plugin but i can't do this.
Tried with this code
cordova plugin add cordova-plugin-lottie-splashscreen
But i facing
'sh' is not recognized as an internal or external command,
operable program or batch file.
Failed to install 'cordova-plugin-lottie-splashscreen': Error: Hook failed with error code ENOENT: C:\Users\bbara\Desktop\GuvercinSepetim\plugins\cordova-plugin-lottie-splashscreen\hooks\ios\update_pod_repo.sh
at C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\hooks\HooksRunner.js:224:23
at _rejected (C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:864:24)
at C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:890:30
at Promise.when (C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:1142:31)
at Promise.promise.promiseDispatch (C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:808:41)
at C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:624:44
at runSingle (C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:137:13)
at flush (C:\Users\bbara\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:125:13)
at processTicksAndRejections (internal/process/next_tick.js:74:9)
Hook failed with error code ENOENT: C:\Users\bbara\Desktop\GuvercinSepetim\plugins\cordova-plugin-lottie-splashscreen\hooks\ios\update_pod_repo.sh
You are running a cordova node but not ionic cordova:
cordova plugin add cordova-plugin-lottie-splashscreen
According to ionic documentation:
npm install #ionic-native/lottie-splash-screen
ionic cordova plugin add cordova-plugin-lottie-splashscreen
And here is the referance:
https://ionicframework.com/docs/native/lottie-splash-screen
And here is the github reposatory of the plugin :
https://github.com/timbru31/cordova-plugin-lottie-splashscreen
Try looking into Capacitor instead of Cordova. You can still use all your Cordova libraries, but the Capacitor build is a bit cleaner. I followed this tutorial and found it very useful with good tools. It worked for me first time, which is never the case with some Ionic stuff!
https://enappd.com/blog/icon-splash-in-ionic-react-capacitor-apps/114/
The issue you are describing was fixed in the v0.8.1 release. It originated from preparing/building the iOS platform on a Windows machine - which won't work anyways. Because cordova-ios supports recent Pod installations out of the box, it's no longer required to sync the repo, i.e, the hook is obsolete. However, the lottie plugin won't fail anymore.
Side note: I'm the author of this plugin.
Senario
I recently upon running an Ionic 3 app, updated (well accidentally) the Ionic CLI version. Now upon running the build from command line, it produces the following error every time and halts the build:
In the error message it says to disable the gulp integration by running the command ionic config set gulp.enabled false which I did. But still getting the same error. I also tried to add the command to the start script of package.json to no avail (not needed though since it seems the config is set globally).
Any help would be appreciated.
Ionic CLI version: 3.9.2
Finally figured out what the problem was. Even if Gulp integration has been disabled with the command ionic config set gulp.enabled false, as long as Gulp is a Dev dependency (i.e. there is a reference to it in the package.json under devDependencies) the Ionic CLI would (well, logically) assume that the Ionic project has a dependency on Gulp, therefore would throw the error (see original post).
Solution
The solution for a case where you don't want Gulp integration, apart from disabling it by running the command ionic config set gulp.enabled false, is to also make sure Gulp is NOT under the devDependencies in the package.json file.
Hope this helps anyone else with a similar issue.
NOTE: Not sure from which version onwards Ionic requires integration with Cordova and Gulp in the shape of ionic.config.json file. Anyway, the above solution will be relevant for a similar case in any of those versions.
i was trying to use live reload on my ionic 2 application. so i found this command
ionic run browser --live-reload
is not working as expected and while making code changes i am receiving console messages
[16:12:47] build started ...
[16:12:47] transpile update started ...
[16:12:47] transpile update finished in 46 ms
[16:12:47] deeplinks update started ...
[16:12:47] deeplinks update finished in 248 ms
[16:12:47] webpack update started ...
but the page isn't reloading
i found the solution on the github page
include a script in the package.json file
"browser": "ionic-app-scripts serve --sourceMap source-map --iscordovaserve --wwwDir platforms/browser/www/ --buildDir platforms/browser/www/build"
and run
npm run browser
When you run the command ionic cordova run browser --livereload you will see something like this in CLI:
[19:39:00] dev server running: http://localhost:8100/
[INFO] Development server running
Local: http://localhost:8100
External: http://192.168.0.51:8100
Just open http://192.168.0.51:8100 or http://localhost:8100 and your live reload will work on that address. Your browser might have opened in http://localhost:8000 instead of 8100
First off, should anyone need this answer, the command has been renamed in the later version to
ionic cordova run browser
Second, The --livereload flag is not supported when you run this command. this issue explains more
Try This
ionic cordova run browser --livereload --consolelogs --serverlogs
"serve": "npx ionic serve --cordova --platform browser"
Using this command browser will be reloaded automatically.
ionic serve
If you want to run application with different platform in browser you can use this command :
ionic serve -l
This both command will reload page automatically on code change
i would like to use the following QR-code plugin in my "m-generator-ionic" project: http://ionicframework.com/docs/v2/platform/barcode/
in ionic framework, the command to be executed to install it is
$ ionic plugin add phonegap-plugin-barcodescanner
what is the equivalent in the m-generator-ionic world ?
I assume you are referring to generator-m-ionic.
You can find a guide here which describes how to write any cordova statement.
In your specific case this would be
$ gulp --cordova 'plugin add phonegap-plugin-barcodescanner'
And if you want to save it to your config.xml:
$ gulp --cordova 'plugin add phonegap-plugin-barcodescanner --save'
Let me know if this was helpful.