I can't get Sublime to show errors such as missing semicolons using JSHint.
I'm using Sublime Text 3, I used the package controller to install SublimeLinter, then installed SublimeLinter-JSHint. I proceeded to install node.js to Windows via the exe, as well as bash via Windows Subsystem for Linux.
I tried to use npm install -g jshint but got an error message I unfortunately did not record. So, I tried to install node.js via bash using:
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
Which seems to have worked. Now when I use npm install -g jshint I get:
/usr/bin/jshint -> /usr/lib/node_modules/jshint/bin/jshint
/usr/lib
└── jshint#2.9.5
This makes me think that I've successfully installed JSHint on the Linux side of the bash since it's showing a Linux based path (if that makes sense). I've made sure JSHint is enabled and that it is on the "background" setting.
I'm very new to using terminal commands and installed packages manually, so please take this into account. I've been searching around for an answer for about 2 hours, but I cannot find a similar situation.
Related
I need help running localhost to connect with vs code. I am trying to open a phaser 3 game I built.
I have tried npm install -g
I keep getting permissions denied.
Could you try with sudo command(if you are using mac or ubuntu)
sudo npm install -g
If you are using windows, then open the terminal with admin rights. (Run as administrator)
Recently working with NodeJS ect. I installed quite different packages, for different tutorials + projects.
I finally ended up with this kind of configuration:
louis#louis:~$ node -v
v5.10.0
louis#louis:~$ nodejs -v
v6.2.1
louis#louis:~$ npm -v
3.8.3
Can you explain the difference between these?
Your situation
Seems you have two different versions of nodejs installed, possibly one was installed from sources and one from package manager like apt.
louis#louis:~$ node -v
v5.10.0
This returns older version of nodejs that you installed, I recommend you to remove it.
louis#louis:~$ nodejs -v
v6.2.1
This returns the current version of nodejs installed, possibly you installed it using package manager, I remember in Ubuntu it comes by nodejs executable name.
I suggest you to create link like this
sudo ln -s `which nodejs` /usr/bin/node
so it will be available using node command also.
nodejs vs node on ubuntu 12.04
louis#louis:~$ npm -v
3.8.3
This is just version of your npm program and has nothing to do with nodejs version.
Better solution
Uninstall all versions that you have and install node using nvm to switch between old/new versions easily
To install or update nvm, you can use the install script using cURL:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash
or Wget:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash
Usage
To download, compile, and install the latest v5.0.x release of node,
do this:
nvm install 5.0
And then in any new shell just use the installed version:
nvm use 5.0
https://github.com/creationix/nvm#install-script
I assume you are using ubuntu. node and nodejs are the same tool, but node is the legacy version and nodejs the current development branch.
npm however is the package manager for node(js).
Here's a bit of helpful information to add to the discussion and which will hopefully help you out regarding node version clashes.
Adding the NodeJs version to your $PATH in your .bash_profile (or it may be called .bashrc or .bashconfig) file will ensure your node calls from the terminal will use the latest and not the legacy version.
Using NVM (Node Version Manager) will allow you to install and change node versions on the fly with 'nvm use 6.0.0' and is highly recommended as some NPM packages will break if using a node and npm version that isn't correct for certain npm packages in your node_modules dir.
You will also have to add NVM to your $PATH in this case, but it's easy enough to do with:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
More details can be found in the link provided.
The OP's question was answered, I know, but I think pointing the OP to a better solution is also a good idea.
I am trying to use Node.js imagemin to compress a lot of images on my server. I like using imagemin because I know how to point it at specific directories.
I am using CentOS 6 and when I run my file, I get the error:
node_modules/imagemin/node_modules/imagemin-pngquant/node_modules/pngquant-bin/vendor/pngquant: /lib64/libc.so.6: version `GLIBC_2.14' not found
Also, when I installed imagemin with npm install imagemin, I got an error that said:
Error: pngquant failed to build, make sure that libpng-dev is installed
Any ideas on what I can do to solve this?
(Problem de facto already solved in the comments - but for the sake of completion and future generations I'm posting an actual answer).
Error: pngquant failed to build, make sure that libpng-dev is installed
This error means that the system is lacking libpng development library, which is needed to install imagemin Node.JS module. To install it on CentOS 6, you need to issue this command:
yum install libpng-devel
Please note that both package manager (here - yum) and package name (libpng-devel) can vary between different Linux distributions.
I had the same issue with CentOS 7 even with libpng-devel installed. It seems the package carries a precompiled binary program in node_modules/pngquant-bin/vendor/pngquant which is somehow incompatible with the Linux installation (CentOS 7 latest).
I have made a solution to the problem by replacing this binary file with the one that is available for CentOS 7.
I am installing the official package pngquant with yum, first. Then I am installing the node modules. You can remove the node_modules folder if you like prior to install action. Its not required, though.
The error will be shown as usual (the program file is not yet replaced):
⚠ The `node_modules/pngquant-bin/vendor/pngquant` binary doesn't seem to work correctly
⚠ pngquant pre-build test failed
ℹ compiling from source
✖ Error: pngquant failed to build, make sure that libpng-dev is installed
at ChildProcess.exithandler (child_process.js:206:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
However, after replacing the binary file everything should be fine.
sh
yum install libpng-devel pngquant
npm install
rm -rf node_modules/pngquant-bin/vendor/pngquant
ln -s /usr/bin/pngquant node_modules/pngquant-bin/vendor/pngquant
After that you can run any command you like, "imagemin:dynamic", etc. It should work properly.
Summary
Generally speaking, the problem appear to be inside the pngquant-bin node package. This solution might help for other Linux distributions as well.
The solution itself is to install the officially supported version of pngquant with the OS package manager and to replace the binary inside the pngquant-bin vendor folder after its installation.
Update
In addition, there is a recent problem that is still related with pngquant npm package. It seems that there is a buggy release of it - lock the required pngquant package in your package.json to older version (last properly running version for you).
The previous solutions didn't work for me. I'm using centos 7.4
When executing executing
# npm install
I recieved the error:
✖ Error: pngquant failed to build, make sure that libpng-dev is installed`
While trying to install libpng-devel, it says it's already installed.
Solution
Update the nodejs & npm version if it's using old one.
I have updated to
Nodejs Version
[root#hosting ~]# node -v
v8.10.0
npm version
[root#hosting ~]# npm -v
5.7.1
Check the installed libpng-devel on your server.
[root#hosting ~]# rpm -qa |grep libpng
libpng-1.5.13-7.el7_2.x86_64
libpng-devel-1.5.13-7.el7_2.x86_64
If you are using epel repo then it will install the latest version. For more libpng release check
[root#hosting ~]# yum list |grep libpng
I have installed
yum install libpng12-1.2.50-10.el7.x86_64 libpng12-devel-1.2.50-10.el7.x86_64
moved node modules
mv node_modules node_modules_bak
Then type
# npm install
in my case, I'm using a CentOS instance on Amazon WS and I faced same problem here. I solved it by installing libpng12 and libpng12-devel (yum install libpng12 libpng12-devel), then running yarn install (or npm install) and the packages did installed correctly.
Just this!
Here's how I resolved the issue for my case:
Delete node_modules:
rm -rf node_modules
Install following dependencies:
sudo dnf install libpng-devel pngquant gcc make libpng12 libpng12-devel
Rebuild dependencies. I use yarn:
yarn
I want to run meteor application in ubuntu. I run following command to install curl.
sudo apt-get install curl
But it gives me following errors:
$sudo apt-get install curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package curl is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'curl' has no installation candidate
please help me to install curl and meteor.
sudo apt-get update
And you might want to consider using this command:
sudo apt-get install libcurl3 php5-curl
Then, to make it easier just use the command wget -qO- https://install.meteor.com | sh. Curl was used on earlier versions of ubuntu. It is not really an essential tool, but some tutorials use it indeed.
As I run this piece of code using node a.js:
var sys = require('sys');
sys.puts('Hello, World');
I'm getting the following as an error
axconfig: port 1 not active
axconfig: port 2 not active
Warning: This is old but it might still work.
You didn't install node.js but the package node (that contains some other unrelated software) for your linux distro.
You can install node.js three ways: Using git, downloading the version file, or installing through the package manager, I recommend using the package manager for ease-of-use and the ability to easily update.
Package Manager
Check out Installing Node.js via Package Manager. It has instructions on how to install using the package manager of your preference.
Direct Download
Go the the downloads page of node.js and download the package for your OS. Don't forget that, doing i this way, doesn't auto-update node.js later on!
Source Compilation / git
First you need git and a compiler, here is how you install them on debian/ubuntu (this depends on your package manager):
sudo apt-get install git-core build-essential
(If you don't want to use git, you can download the source code from the website. You still need build-essential or equivalent for your OS.)
Then go to a folder where the "node" repository will be placed, something like ~/projects or ~/src is good enough, and do this:
git clone https://github.com/joyent/node.git
Then enter the node directory, configure it and build it.
cd node && ./configure && make
Everything should go well. Before installing node you can optionally run the tests to check for any problems:
make test
You can finally install node, this allows you to run the node command anywhere in the system and the javascript libraries to be installed.
make install
...and we are done.
You can test those lines of code using node-repl (node's REPL, think "interactive interpreter"), just type node-repl, quit with Ctrl+D.
axconfig: port 1 not active
axconfig: port 2 not active
this problem no where related to nodejs.
Do not install node using the command sudo apt-get install node, This will install radio package(node). this radio package requires axports to be active, which is not linked with nodejs
So uninstall node from sudo apt-get remove node
Manually Download nodejs from Here or from GitHub but make sure you install the stable branch(0.4.x).Unpack the nodejs.
For installing please follow the README.md
After installing then set the environment variables echo PATH=$PATH:/home/user/pathtonode/
you installed node, you want the package called nodejs
If you are on ubuntu, follow:
sudo apt-get update
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
You need to install nodejs and not node!
Brandon Helwig is correct. It just happened to me. In general, if you get this type of error, you have installed the wrong package. Here are more instructions for you to install one of the latest versions of Node.js.
Fix
sudo apt-get remove node
This will remove the accidentally installed package. Both names for the package node and nodejs are the same which is node.
If you do sudo apt-get install node, what you would get is a old version. But thanks for Chris Lea, we got a PPA for this task.
sudo apt-get update
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
This should get you the latest version of Node.js in your application.
If you are in need of an bleeding edge version, you can install from the source. But I think this is way cleaner.
This problem is occur in ubuntu,so I resolved this problem by git. Clone this new source from github
and do following actions:
Uninstall node
sudo apt-get remove --pure node
sudo apt-get clean
Make install node
git clone https://github.com/joyent/node.git
cd node
./configure
make
make install
Then this will be work well.
If Node.js installation as suggested by ninja works for you (like on AWS Ubuntu):
sudo apt-get update
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
you might still want to add node to your system path like this:
export PATH=/usr/bin/:$PATH
so you can type
node webapp.js
instead of
/usr/bin/node webapp.js
Find your node installation path simply by typing
which node
The easiest way is to remove the node installation first and then install npm.
npm is the Node Package Manager, this will automatically install nodejs itself