ERROR in Node Sass does not yet support your current environment: Linux

We might come across this error at some point while dealing with node js and its related components.

ERROR in Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (57)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v3.13.1
@ ./lib/scss/bootstrap.scss 4:14-176

Try running the following command and which would fix the above issue.

npm rebuild node-sass

Advertisements

Debian : Setting environment variables for all users

An environment variable like JAVA_HOME can be set in different ways in  linux systems.

#1 . If we set environment variables in .bashrc file found in each users home directory, it will be accessible only for that user.

~/.bashrc   ——> specific to a particular user.

Setting environment variable for all users.
If the environment variable to be available for all users,

#2.   it can be set in /etc/environment

For instance let see how JAVA_HOME can be set,
Open this file in  vim or any editor of your choice, and add following line in it.
JAVA_HOME=”/usr/lib/jvm/java-8-openjdk-amd64″.
This sets JAVA_HOME for default open JDK. Please note that location is specified in quotes,

Then save the file and run the command, to have these these changes in effect immediately.
source /etc/environment
But this is not a recommended method.

#3. Setting via /etc/profile

vim /etc/profile (open the this file in vim )
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
Then save the file and run following command.
source /etc/profile

#4. Setting via /etc/profile.d
This can be viewed as an extension to the above step. Having all application specific environment file in /etc/profile makes the maintenance a hassle. As a solution to this, variables will be specified as a separate module inside the directory /etc/profile.d/. These modules are shell scripts and should end with .sh extension, otherwise system is not going to recognize it. You can read further on this from here.

I think this would be clear, with the following example.
In order to set JAVA_HOME bythis approach, first create a java_dev.sh file inside /etc/profile.d (The file should end with .sh extension ).

Then open this file using vim or any editor
vim /etc/profile.d/java_dev.sh
Then add following lines ( This JAVA_HOME location could be different for others)

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=${JAVA_HOME}/bin:${PATH}

Then save the file and run the following command.
source /etc/profile

You can also consider reading this

Linux – Exclude Certain Files and Folders while Copying

When we copy a certain folder to a remote machine using scp, we might want to exclude some sub folders or files. The following command worked for me in those kind of situations.

scp !(bin) root@target-machine:/opt/your-folder-name/  

In this case, it copies everything except the bin folder from the current working directory to /opt/your-folder-name/ folder in target-machine

Access denied issue with mysqlimport with remote machine

On importing a csv file into a table with same structure that placed on different machine, with mysql import using mysql root user , it is common that we may end up with some access denied error messages.

mysqlimport -h yourhostname –port 3306 -u root -pyourpassword –fields-terminated-by=’;’ –local csv_test tweet.csv

For instance the above stated query which worked in some machines, may raise

mysqlimport: Error: 1045 Access denied for user ‘root’@’ipaddress-of-remote-host’ (using password: YES)

The fix to this issue is as follows :

  1. First check the my.cnf file ( inside /etc/mysql folder ) and look for the line :

bind-address = 127.0.0.1

If it not commented, comments it out, as :

 #bind-address = 127.0.0.1

This tells system that, this mysql is accessible from different hosts as well.

2. Next we need to grant permission to the root user.

For that login to the mysql prompt using mysql -u root -p. Then execute the following query,

GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’ IDENTIFIED BY ‘password’;

3. Now restart mysql using the command:

service mysql restart

VirtualBox – Copy Paste Not working (Debian)

Even though you have set bidirectional for the option Shared Clipboard in settings ( under General –>Advanced ) some times it will not work. The following steps fixed this issue for me.

In the guest OS do the following :

  1. update source.list file
  • enable the contrib repositories; e.g. for Debian 8, make sure your /etc/apt/sources.list contains something like
    deb http://ftp.debian.org/debian jessie main contrib

2.  Install guest addition software.


apt-get update
apt-get install virtualbox-guest-dkms

RabbitMQ – Status Checking

To see the status of rabbitmq

sudo rabbitmqctl status

To stop the rabbitmq

sudo rabbitmqctl stop

(Try the status command again to see that it’s stopped). To start it again, the recommended method is

sudo invoke-rc.d rabbitmq-server start


Still not getting it up ????

Try restarting your system. It is supposed to work now. 

Celery -Bound Tasks

A task being bound means the first argument to the task will always be the task instance (self).
Bound tasks are needed for retries (using app.Task.retry()), for accessing information about the current task request, and for any additional functionality you add to custom task base classes. Ref

An example to get the tasks ID of current tasks has been added below :

@app.task(bind=True,name=”tasks.get_ID”)
def get_ID(self):
print “hooo”
print self.request.id

It is always a good practice to give names to tasks otherwise it will go for automatic  naming which in some situation may lead to tasks unregistered error.