Bits and Bytes
Installing global npm packages without sudo
If you want to avoid that you have to use
sudo for installing global npm packages here is how you can change the path where the node modules are installed to a directory that does not need root rights.
npm install -g should work just fine with normal user rights.
Making sass image-url work
To ensure correct paths to your assets (e.g. pictures) in Rails it is recommended to use the
image-url helper function.
Unfortunately I found myself confronted with the problem that this worked fine my production environment on Heroku but not in development. I fixed the problem by deleting everything inside the assert cache folder. You can use this command when you are in the root directory of your Rails project.
Updating node.js using n
I had troubles updating node.js on my Ubuntu 14.04 system using the provided n package. Here the commands that made it work for me.Ubuntu 14.04 node.js n
Overwriting node config values
If you are using the node-configmodule to handle your configuration you might get in trouble when running tests. Either you want to run tests for different config values or you want to set some value that would usually be set via a local config which does not exist in the testing environment.
As an example let's assume a config file with this content:
To overwrite this you need to allow mutations on the config options. This is either done by including
ALLOW_CONFIG_MUTATIONS = 1 in your npm test script or by putting this at the very top of the test file that is first requiring the config module:
server.ip can be overwritten with like this: