Angular application throws exception at compile time - node.js

I have an Angular 2 application, running in Electron and using Knex for database interaction that has successfully compiled and run several times over. After several edits, I attempted to run the application locally and received the error ReferenceError: "yexecutor is not defined".
Googling the error yielded no results. I have gradually commented out every line of custom code written by me and still the error occurs. I've even rebooted my rig thinking, perhaps, Node was just acting up. After a reboot, I'm still getting the error.

After commenting all of my own code, rebooting and finally dying and coming back to life to try again, I remembered I was investigating the source of some of the packages I had installed. So, I decided to try deleting the node_modules directory and execute an npm install.
A few minutes later, I'm back to a successful compile!
Steps to solve:
Delete node_modules
npm install
I must have fat fingered the keyboard while meandering through the packages! That, or my cats decided to become contributors.
Viola!

Related

cypress cache clear hanging

For context I am working in windows 10 with Node.js.
Having set up cypress successfully after a load of trial and error in one project file I am starting from scratch with another project file to work out the exact steps.
For some reason it is failing with the new attempt and having noticed the errors show v 7/3/0 whereas the errors for the previous showed v 7.2.0 I thought I'd return to the first project file and try
cypress clear cache as recommended at docs.cypress.io/guides/references/troubleshooting which I've assumed that was to be run at the Node.js command prompt.
Having done so Node.js is just hanging.
Is this expected behaviour?
Have I misunderstood the instructions?
Thanks

angular project npm modules randomly deleted

I have the weirdest problem I've ever seen with npm where in the middle of running an angular ng serve, packages from both node and for angular will randomly go missing. In the middle of a save, the project will suddenly not recompile, and will complain about a missing module. Each time it has been different but so far I have had:
Error: ENOENT: no such file or directory, open '.../node_modules/core-js/internals/hidden-keys.js'
Module not found: Error: Can't resolve '../internals/is-pure' in '/.../node_modules/#angular-devkit/build-angular/node_modules/core-js/internals'
An unhandled exception occurred: Cannot find module './internal/streams/stream
An unhandled exception occurred: Cannot find module '/.../node_modules/minipass-collect/node_modules/minipass/index.js'.
Please verify that the package.json has a valid "main" entry
These have just been errors from the last few days, but issues like this has been happening all. to the point where I need to delete node_modules and reinstall everything via npm at least once a day. I'm thinking the error has more to do with node or NPM than with my Angular set up, as some of these missing packages appear to be node core packages.
I've already tried reinstalling npm globally via npm install -g npm and it hasn't helped anything. I'm afraid that I'm going to have to just reinstall node completely.
Any help would be appreciated, thank you.
EDIT: upon further debugging, I'm noticing that the modules missing are always from #angular-devkit/build-angular/node_modules/core-js/modules. In addition to losing random modules like 'is-pure', the app will also randomly recompile many times when running ng serve
I figured out what was going on, if anyone in the future has the same problem. Turns out the answer has nothing to do with me botching my npm config. I didn't realize that on new Macbooks, any directory in the desktop is automatically managed by iCloud. At some point, probably an older version of the code before I migrated to Angular 9 was syncing the old code into my project. I was able to resolve this issue by changing the name of the parent directory where my project lived from filename to filename.nosync. adding '.nosync' causes iCloud to ignore syncing for whatever is in that file. I know I should have caught this, but hopefully this will help any mac users in the future who are experiencing similar problems.

Node JS Randomly stops executing - Shows no errors

I am not sure where to start looking for the issue here.
I recently updated from angular 5 to angular 8. The application runs fine after the update. I don't know if this is related.
All of the sudden, my Node JS scripts stop seemingly at random. Sometimes they run, usually they don't. This is any script.
By "Stopping" I mean the console, mid execution, leaves the last line it wrote up, and on the next line, I am able to write more commands.
Example:
C:\location\> npm start
ng serve --aot
** Angular Live development server is listening on .....*
12 % building 22/23 modules 1 active ...somefile.ts
C:\location\>
There is no error, even when I run --verbose. Also, if I have multiple windows up or multiple servers running, they all stop at the same time. It is happening regardless of the application or package, including http-server, Angular, and installing dependencies.
I couldn't find anything related online. Has anyone ever seen this?
Update:
The issue is caused by my lack of CPU.
I thought I fixed it by updating, but that didn't work.
----------- (previous reply, not a solution)
It appears some of my installed dependency versions conflicted with package.json. Basically something did not fully update as expected.
I resolved the issue by running npm install.

Node serving an old version but still compiles updates

I'm creating a React application and am running into this issue. When I make changes to code, Node does recompile and even recognizes errors in the code, but no matter what, the localhost in the browser remains unchanged. Here's a list of things that I've tried:
Clearing the browser's cache and hard reloading the page
Switching browsers
Turning Node off and on again
Reinstalling Node
Creating a new directory, copying over the code, and then installing Node there
Turning the whole computer off and on again
I'm not sure what to try anymore. When installing Node, there are no errors, and no errors if I run npm start or npm build. As I said, I know Node is looking in the right directory since it recognizes when I make changes and shows errors when the code fails to compile. I also know I'm looking at the right localhost page since it isn't available when Node isn't running. However, the page remains perfectly usable and unchanged even if the code fails to compile, and actually is able to load before Node compiles all of the code.
I got the code itself from a zip file from GitHub and people who have their frontend set up have no issues with it. Node and all the other dependencies were downloaded by me, again, with no errors.
I'm using Node v10.16.0 and npm v6.9.0

Node won't run, just exits code 0

Well some days ago I was tired to always call sudo when calling npm install and that sort of things so I tried uninstalling node and tried installing via Homebrew, I managed to make a huge disaster but finally it worked. Until now...
When I run node app.js or npm install it just doesn't do anything.
I tried deleting the related files like this.
I tried using nvm.
Tried the manual install with the .pkg file from the node homepage.
Tried through homebrew again.
And still no luck; however if the Node app has compilation errors I get the error stack, but when everything is "ok", instead of start listening for incoming connections it just exits with code 0.
Ok, I feel reaaaaaaaaally stupid after I found the issue, in my postgresql config I had the wrong password for the database and for some reason caused all this mess. Will upvote all of you, will understand if you downvote me for being such a moron.
OneOfOne's node debug then keep pressing s did the trick for me.

Resources