Friday, June 30, 2017

You are trying to run npm install on an existing git repository, but your npm install stops somewhere at fetchMetadata and throws an error code 128, which doesn't tell you much.

First of all, there are multiple possible causes for error code 128, most of them have something to do with permissions, so make sure you have access permissions and you're using proper ssh key(if any).

However, if that doesn't solve the problem, you might try this:
Try to split the package.json file's dependency list into N subgroups and run npm install on those chunks.

This way, it will download some packages every time, and it won't download them anymore when you run npm install for the next chunk.

I'm not sure what's root cause of this bug, but it seems to be a potential bug in npm v.5.0.0+. This needs some more research, but for the moment, I hope that the trick of splitting the npm install load will do the trick for you!

This was tested with node v8.0.0.0 and v8.1.3 with npm v5.0.0 and v5.1.3.
OS: Ubuntu 16.04
(nvm was used as the node manager, and the package.json contained both free and private git repos hosted at bitbucket and github).

UPDATE:
Possible reason for this error is the too high number of connections npm is trying to open. For some internet routers / connections, it might simply be too much. Currently, there's no official ability to limit max connections from npm, even there were some discussions on this in past. Lets hope this will be added into the newer versions.

Also, npm's error log is very bad at reporting the root cause of this error. In most cases, it simply says error code 128. However, every once in a while, it will print out something like Connection refused, or cannot connect to remote repository - host unknown, or something.

This error has a tendency to show up at large repos , filled with lots of git+ssh entries.

This issue might be somewhat related to this problem too:
https://github.com/npm/npm/issues/7862

Sunday, June 25, 2017

If you are experiencing missing Session Cookie while using NodeJS (and probably any other server side framework), remember that:

Your client and your server should be on exactly the same domain. For example, if client is set to http://127.0.0.1 and connecting to server at http://localhost, cookie won't be saved - Web Browser is going to reject it (rejects Set-Cookie command to protect your safety)

Sunday, June 18, 2017

In his superb book "Getting Things Done", David Allen introduced a phenomenal approach to creative project management. In one important section, he talks about natural order of thinking when looking to complete a non-trivial project. It is a powerful 5-step process:1. Why

You MUST have a super strong WHY, if you hope to ever complete a complex project. Nothing below makes sense without a very powerful WHY.
If there are problems on lower levels of this hierarchy , always go back and redefine your WHY.

2- Vision of successful outcome

See yourself after the success. Vividly. It opens up your subconscious eyes to see things you've ignored all the time.

3. Brainstorming
This is beginning of How part. Write down, draw down all things that come to your mind for which you believe that could potentially help you realize the successful outcome you envisioned in step #2.

Mind mapping by Tony Buzan can help here.
Make no judgement and no analysis at this step. Every idea is a good idea.

4.Organization

Connect the dots, isolate the processes, streamline actions. Make some Gantt charts if needed.

5. Next actions
Make concrete action plan and execute them. After execution, move to Next action and redo.
Reward yourself for every action completed - it's one step forward to your successful outcome, it's a big thing!

Also, written plan of next actions help us focus and maintain it for a longer period. Most of us cannot focus more than a couple of minutes to the task at hand, without a significant external motivation. This is why written plan of next actions, and the vision of whole project is really helpful - it makes us feel more control over the project and increases our confidence in the whole project.

These tips are about Vagrant on Windows, coupled with NFS using VirtualBox NFS plugin.

#1 If Vagrant ssh terminal is getting stuck
If your Vagrant ssh terminal is getting stuck all the time, check if you have multiple running vagrants:
vagrant global-status
and then halt / destroy them by id.

#2 If Vagrant VM is slow
Any wrong flag or option in Vagrantfile shared folder settings can degrade your VM's performance by 10x! For example, this is a valid synced folder entry for windows host using NFS:

config.vm.synced_folder ".", "/vagrant", type: "nfs"

Be careful when modifying this basic line, as any extra option can be the cause of slowliness of your VM.

Wednesday, June 14, 2017

We all run dozens of programs running simultaneously. We all use ALT-TAB to quickly jump between those programs. ALT-TAB looks like a time saver. And it probably is. On the other side, we never consider a potential downside of using this, and other similar, keyboard shortcuts:

Pressing ALT-TAB will bring a new program to our screen instantly. Computer has no problems with fast context switching. But what about us - human beings? I'm not entirely convinced that we can do a quick context switch, without sacrificing our current thoughts.

Here is my challenge for you:

Can you try to avoid using ALT + TAB for 1 whole week. If you succeed at it, let us know how it felt? Has your productivity soared, jumped a little bit, or degraded?

I'm sure that there are some productivity awards for those who can endure this challenge. :)