How can I solve a crash in an Adonis app starting? - node.js

this is my first question ever. I'm trying to run an Adonis.js app by entering adonis serve --dev at the terminal. The messages are always the same in this succession:
SERVER STARTED
Watching files for changes...
Fatal error in , line 0
Check failed: U_SUCCESS(status).
FailureMessage Object: 000000D7655ECBA0Application crashed, make sure to kill all related running process, fix the issue and re-run the app
The only thing that changes is the FailureMessageObject. My Node version is 12.0, npm 6.9.

I can't say anything seriously working on your situation cause you gave me no detailed data but I know that surely you are doing something wrong.
It could be better if you at least mentioned the version of adonisjs you've been using.
Anyway, if you learned to run your server from a video from someone else's youtube channel, I strongly recommend you to read documentation and stop watching those videos.
And for adonisjs there are 2 different documentation:
adonisjs's Documentation, version 4.1 or less.
You can change the version on top left combo box.
adonisjs's preview Documentation, version 5.0.
Actually the documentation is not still completed at this time but the version is stable. yeah, that's the reason why I wrote preview.
And that's it, start recreating an adonisjs app from documentation guides.

I solved it. It was something with node or npm. I followed this steps enumerated in this post: How to completely remove node.js from Windows. Reinstalled node. Installed Adonis and it's CLI again and created an app and this time the app didn't crashed, and ran smoothly (after that I also created some migrations and they too worked well).

Related

Angular SSR Hot reload not working, no error, hung

I added angular universal to my project and upon saving, it compiles successfully though in the network tab I can see the request for whatever route im on gets hung on pending and the website stays loading forever in the browser. This issue is not present during CRS. Things I have tried that did not work:
I have cloned the same project elsewhere to see if it was some fat finger accident
I have not only add logic to stop DOM methods from being used, I have outright removed the use of them everywhere in the app
I added 3rd party libraries like Domino js to mock methods on Node
I started a completely blank angular project, added nothing to it other than angular universal and I get the same issue!
I will try it on another computer soon to see if it is just an issue on this machine.
What could the issue be? I don't get any errors and refreshing the page it works.
Is hot reload broken for me? missing anything?
EDIT: I have now tried it on a 2 other Windows machines and the result is the same. Perhaps this is a bug. Essentially makes Angular useless to me.
Angular Version 12.1
I was able to get it to work by upgrading my Angular to version 14, and starting a fresh project with SSR added. Frustratingly to say the least but I can finish my project and I copied back in most of my code from the project I was working on.
For what ever reason Angular 11 and 12 were giving me this issue on multiple machines on fresh angular projects. It never gave me any errors to show. I will report back if any time during the rest of the porting of code if the issue persists.
I had the same hassle when initially integrated the Angular Universal to my project.
After a period of time I consider the according workaround:
SSR for the single page applications is useful in production for SEO, Open Graph, etc.
Angular Universal adds additional files:
main.server.ts
app.server.module.ts
Then the classic angular approaches are still possible to be used (the old app.module.ts).
Now for the local development environment I'm continue using the classic "ng serve" command and the Angular continue reloads normally on each file change.
And the SSR is compileing only for the production build.
Then if I want to debug something related to the SSR I'm deploying the production build to the test environment and calling the test urls to see the results.

Old `npm start` script being ran by Google App Engine

Despite re-deploying and even disabling/re-enabling the application Google App Engine keeps trying to run the npm start script from an old version of the app. I noticed this because it used to try to run a migration script, then start the server. Now the migration script errors, which is what got my attention.
I've since tried to also update the version number in the package.json since the logs that are failing specified it was trying to run version 1.0.0 of my app. So I figured maybe I need to bump the version.
Despite that, the log that errors still says PROJECT_NAME#1.0.0 start: npm run migrate && node src/server.js which is clearly the old one.
I started a project on Node.js Flexible environment for Google App Engine, then switched to Standard environment (which was released shortly after I started the project). I'm speculating that perhaps it's trying to run flexible environment script too? But, I don't know how to make it stop.
Oh, one more important detail: The app is running and working despite supposedly erroring on startup. So it definitely seems like it's trying to run both versions and only one is succeeding.
It turns out there was an old instance running in the "flexible" environment.
Deploying a new "default" service running in "standard" environment does not seem to stop other deployed versions in the "flexible" environment.
The fix involved opening Google's Cloud Console for App Engine, clicking "versions" and finding/stopping/deleting the old versions from "flexible" environment.
Huge thanks to #Steren for helping me figure out what was going on.

Debug node.js web application that has been launched via a Gulp task

I have a web application that is written in node.js and gets started using a gulp command. When the application first starts, before the server is running, debug points may be hit in WebStorm (or in any IDE or command line tool). However, after the server is running and I go to the interface in my localhost I can no longer hit debug points inside the application. This is not being caused by client side code as the debug points are in server code.
I have read the answers that involve using the node-inspector and that has not solved my problem because of configuration files that are not getting read when starting the debugger in node inspector.
I'm a bit surprised that there is so little on here about this issue. Is it not a normal problem that other developers face? Thanks in advance for the help.
My workaround for this may not be sufficient for every case. I was modifying JavaScript files and didn't actually need the configuration files, after loading, to be able to test my changes. I did the following:
Wrote a line in my app.js file that set the variables I needed. (these would have been tasks ran in Gulp)
I then started the app as a Node.js app and was able to debug it as normal.
If any of my views had been updated, or anything else that was being managed by Gulp, then I could have simply stopped the server, started it again via the Gulp command, and then stopped again and restarted as a Node.js app.
This did not solve the issue in my OP but it was a good enough workaround to get debug points in the JavaScript.

Basic debugging of Electron apps

I'm using Electron to build a native application, based on existing code (developed with Electron v0.26.1). I'd like to use features available on more recent versions of Electron, so I changed the version number in package.json to v0.36.9 (the most recent one so far) and reinstalled its dependencies.
Now, I fully expected the applicaton to break when running npm start, and indeed it does, but I didn't expect the error message to be so uninformative:
Error opening app
The app provided is not a valid Electron app, please read the docs on how to write one:
https://github.com/atom/electron/tree/v0.36.9/docs
Error: Cannot find module '/home/user/electron/myapp/build'
I'd appreciate if it would say why it is no longer a valid Electron app, give any sort of stack trace, or file causing the issue.
Running npm start did create a build directory like before, which contains several files, just like before the upgrade. From the way it's worded, I cannot know if the Cannot find module message is the cause of the error, or the consequence. And if it is the cause, I have no idea of who or what is requiring such module, since before the upgrade this had never happened.
I tried "standard" debugging techniques, like running npm start --debug (the flag exists, but is not useful in this situation), npm rebuild, reading the Electron FAQ, looking for any *.log files (none to be found), and looking for occurrences of require('build') or something similar (no such occurrences). Nothing helped.
How can I get any information at all about why this is failing? Every programming language/build system I know of would at least output the source file where the error occurred, and possibly more information.
In your app's package.json there probably something like:
"scripts": {
"start": "electron /home/user/electron/myapp/build"
}
That's the command that will be executed when you run npm start, so fix the path in there to point to the .js file that contains your app entry point.
Well, after bisecting changes here and there, and following Vadim Macagon's advice to look further into package.json, I found out that the following change was responsible for the complete failure:
Changing "fs-jetpack": "^0.6.4" to "fs-jetpack": "^0.7.1"
Now, unfortunately I still have absolutely no idea about why that happened, or how I could have possibly found it out other than blindingly changing settings here and there.
This is not the answer to my question (I'd still like helpful information about how to debug Electron apps to avoid similar problems in the future), but it does allow me to keep working. That is, if I decide to keep using Electron, which I'm no longer sure it's a good idea.
Edit: There is at least one related issue on Github, but it has been closed and the issue has not been resolved.

After setting up the example Loopback app, how come my StrongOps dashboard stays empty?

I followed the guidelines for installing Loopback example app, and registering to StrongOps monitoring service, like documented in the Getting Started doc
Installing and registering was flawless, but now I don't see nothing happening on my StrongOps dashboard, why ?
I even followed the step of running the stress test to be sure that some metrics are sent, but the dashboard stays empty.
$ slc run bin/create-load.js
Side note : The documentation does not mention the fact that when you quit the REPL command line, you actually stops the web server. First time I did this, I could not load the stress tests and did not understand why, until I realize the app was offline. Trivial, but should be in a Getting started doc.
Version used :
$ slc version
slc v2.2.2 (node v0.10.22)
Sorry, you got caught between rolling out updates to our tooling on npmjs.org, and updates to our documentation. We recommend running with strong-supervisor, which should be co-installed with strong-cli, though you may have to update:
npm install -g strong-supervisor
npm update -g strong-cli
At this point, you can run with
sl-run
and it will run the sample (or any app, without having to add a direct dependency on strong-agent) with strong-agent profiling, and strong-cluster-control worker/robustness management.
https://github.com/strongloop/strong-supervisor
We'll be continuing to work on our tooling integration over the next few sprints.
I believe there was a weekend maintenance done on StrongOps today. Can you retry ?
I am getting my data right now.
Shubhra
Actually, I found out.
Despite the documentation says the example app comes out of the box with strongOps support, it does not.
I had to enable it manually :
$ npm install strong-agent
In app.js, before the app dependencies :
require('strong-agent').profile();
Then, I relaunched the example app and now the dashboards starts to looks like there is something
However the charts stay empty for the moment, despite the example app and load app have been running for about 1/2 hour.

Resources