Plesk install npm packages Error - node.js

I created an API that use hummus.js modules. Localy tested -> Works fine.
Now I uploaded my API and try to run npm install to install all dependencies. But I got this Error:
npm-Installation
Execution filemng has failed with exit code 1, stdout:
> hummus#1.0.81 install /var/www/vhosts/XXX/XXX/node_modules/hummus
> node-pre-gyp install --fallback-to-build
, stderr: npm WARN lifecycle npm is using /opt/plesk/node/7/bin/node but there is no node binary in the current PATH. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
/usr/bin/env: 'node': No such file or directory
npm WARN XXX#0.0.1 No description
npm WARN XXX#0.0.1 No repository field.
npm WARN XXX#0.0.1 No license field.
npm ERR! Linux 4.4.0-21-generic
npm ERR! argv "/opt/plesk/node/7/bin/node" "/opt/plesk/node/7/bin/npm" "install"
npm ERR! node v7.4.0
npm ERR! npm v4.0.5
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! hummus#1.0.81 install: `node-pre-gyp install --fallback-to-build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the hummus#1.0.81 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the hummus package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs hummus
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls hummus
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/www/vhosts/XXX/XXX/npm-debug.log
The Error come from the hummus-js package.
So I want to try install node-gyp ( npm install -g node-gyp ). But I don't know how? In Plesk I canno't install a single module. When I try it with ssh i got:
command NPM not found
I'm a Server-Admin-Noob so I'm happy for every Help!
Greetings
EDIT:
My Server = Ubuntu 16.04 LTS Server 64bit + Plesk Onyx

If I assumed correctly, it boils down to you not having Node installed on your other machine. SSH into the machine, then, for debian and ubuntu-based OS run
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
(assuming, again, that you wanted Node 8.x), then run
sudo apt-get install -y build-essential
and for CentOS and other enterprise Linux OS:
curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
sudo yum -y install nodejs
sudo yum install gcc-c++ make
Then try redoing what you did.

Related

Why can't I install a specific version of npm and how can I do it?

My Linux distribution is:
uname -a
Linux 16.04.2-Ubuntu
Also, my npm version was:
npm -v
3.5.2
I wanted to install version 3.10.10 of npm via this command:
sudo npm cache clean -f
sudo npm install npm#3.10.10
But I get these errors:
npm WARN enoent ENOENT: no such file or directory, open '/home/arvin/package.json'
npm WARN myname No description
npm WARN myname No repository field.
npm WARN myname No README data
npm WARN myname No license field.
And when using the same command for installed version 6.12.2 of Node.js:
sudo npm install nodejs#6.12.2
And I get these errors:
npm ERR! Linux 4.13.0-26-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "nodejs#6.12.2"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! No compatible version found: nodejs#6.12.2
npm ERR! Valid install targets:
npm ERR! 0.0.0
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /home/arvin/npm-debug.log
Finally, I decided to completely remove `npm' and Node.js via these commands:
sudo apt-get purge --auto-remove nodejs
sudo apt autoremove
sudo rm -R ~/.npm
sudo rm /usr/local/bin/npm, /usr/local/share/man/man1/node, /usr/local/lib/dtrace/node.d, ~/.node-gyp, /opt/local/bin/node, opt/local/include/node, /opt/local/lib/node_modules
sudo npm uninstall npm
So, how can I install npm v3.10.10 and Node.js v6.12.2 in Ubuntu 16.04 (Xenial Xerus)?
If you want to use npm to install npm, you need to use the -g flag to signal that the package should be installed globally. If you install without the -g flag, it will try to find a package.json file in the local directory.
sudo npm install -g npm#3.10.10
Btw, you cannot install Node.js with npm. To manage Node.js versions, you can use either nvm or n. I recommend using n.

Node 8.0 install, but npm stuck on old version

Installed node version v8 on windows 10. It says it comes delivered with npm 5....
But it's stuck on 3.5.3
λ npm i -g npm
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "npm" "i" "-g" "npm"
npm ERR! node v8.0.0
**npm ERR! npm v3.5.3**
**npm ERR! code MODULE_NOT_FOUND**
**npm ERR! Cannot find module 'internal/fs'**
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\user\npm-debug.log
What i've done:
Uninstall node and reinstall it
Install a different version of node (7.7.0) and see if it updated npm
used npm clean cache -f
And none of these things worked...
So any ideas?
I had the same problem and had to run
npm install npm#latest -g
from the command line. I was told node and npm versions will be different.
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

Install electron on ubuntu

When I try to install electron on Ubuntu 15.04 using
sudo npm install electron-prebuilt -g
This is what I get
/usr/local/bin/electron -> /usr/local/lib/node_modules/electron-prebuilt/cli.js
> electron-prebuilt#0.28.3 postinstall /usr/local/lib/node_modules/electron-prebuilt
> node install.js
Downloading electron-v0.28.3-linux-x64.zip
Error: tunneling socket could not be established, cause=139936635598656:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:795:
/usr/local/lib/node_modules/electron-prebuilt/install.js:15
throw err
^
Error: tunneling socket could not be established, cause=139936635598656:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:795:
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! electron-prebuilt#0.28.3 postinstall: `node install.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the electron-prebuilt#0.28.3 postinstall script.
npm ERR! This is most likely a problem with the electron-prebuilt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls electron-prebuilt
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.19.0-18-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "electron-prebuilt"
npm ERR! cwd /usr/bin
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /usr/bin/npm-debug.log
npm ERR! not ok code 0
I tried
Creating a system link for node with the command:
ln -s node nodejs in the /usr/bin/ folder
and
installing node-legacy package: sudo apt-get install node-legacy
as suggested here
with no luck.
Couldn't find anything more on other forums.So please help.
Thanks in advance.
Following steps worked for me:
(Assuming node and npm are already installed)
Updated the npm package to latest:-
sudo npm install npm#latest -g
Installed electron with following switches:
sudo npm install electron -g –-verbose --unsafe-perm=true --allow-root
Corrections/Suggestion from experienced people are always welcome. Hope it help to somebody.
use:
ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/ npm install
Most likely you are behind a proxy.
You can disable it or make npm install work behind a proxy (see this question).
You typed it wrong
install nodejs-legacy
sudo apt-get install nodejs-legacy
to fix it and then continue installing electron
sudo npm install electron-prebuilt -g
sudo npm install electron -g
This worked for me
First install latest version of node and npm by
$ curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
$ sudo apt-get install -y nodejs
the latest npm version is now 6.9.0, check the npm version with npm --version
if the npm version is 6.4.1 just first update npm by
$ npm install -g npm
If you have problem with permissions caused by sudo then you can cd into .npm-global
$ cd /home/user_home_directory/.npm-global/
using chmod command to change permissions of all files and directories in this folder:
$ sudo chmod 777 * -R
After installation you must add this line to the end of .bashrc file:
export PATH="/home/user_home_directory/.npm-global/bin:$PATH"
After saving .bashrc just source it by
$ source .bashrc
After all done, you can install electron globally by
$ npm install -g electron
I reached here because my final app wasn't installing on ubuntu.
In case someone has the same problem go to the build location and run from terminal using :
sudo dpkg -i <name of your install/build file>
p.s. I didn't find this solution anywhere else which is why I'm posting it here
Using this helps me:
sudo npm install electron -g --unsafe-perm=true --allow-root
without --unsafe-perm=true --allow-root I got error message like this:
> electron#10.1.5 postinstall /usr/local/lib/node_modules/electron
> node install.js
Error: EACCES: permission denied, mkdtemp
'/usr/local/lib/node_modules/electron/electron-download-rSlUcU'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron#10.1.5 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron#10.1.5 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional
logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-11-13T04_43_27_809Z-debug.log

Trouble installing topojson on ubuntu

I've been trying to install topojson by following Mike Bostock's Let's Make a Map tutorial http://bost.ocks.org/mike/map/ and I believe I have managed to get the most recent version of Node.js and npm. $which ogr2ogr works as well. I'm quite new to programming and Ubuntu and would sincerely appreciate some thorough help as to why npm install topojson -g yields the following errors. When I try the same command with sudo it yields errors like: npm ERR! registry error parsing json and gyp ERR! stack Error: "pre" versions of node cannot be installed, use the --nodedir flag instead
Thanks!
npm ERR! Error: EACCES, open '/home/natecraft/.npm/7edf76d6-topojson.lock'
npm ERR! { [Error: EACCES, open '/home/natecraft/.npm/7edf76d6-topojson.lock']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/home/natecraft/.npm/7edf76d6-topojson.lock' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.5.0-23-generic
npm ERR! command "/home/natecraft/.nvm/v0.10.15/bin/node" "/home/natecraft/.nvm/v0.10.15/bin/npm" "install" "topojson" "-g"
npm ERR! cwd /home/natecraft/Downloads/node-latest-install
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.3.5
npm ERR! path /home/natecraft/.npm/7edf76d6-topojson.lock
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open '/home/natecraft/.npm/7edf76d6-topojson.lock'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/natecraft/Downloads/node-latest-install/npm-debug.log
npm ERR! not ok code 0
First, please check your version of node.js -- use the stable version, not the devel version. Second, invoke the npm command as superuser.
$ sudo npm install -g topojson
So far, when I switch my node.js into stable version, TopoJSON installation is running well. Thank you for your attention.
I came across this error when installing topojson (Debian 3.2.0-4-amd64). My steps to get things working (also discussed here).
Install node v 0.11.10
git clone https://github.com/joyent/node.git
cd node
git checkout v0.11.10
./configure && make
sudo make install
Remove debian gyp and install via npm:
sudo apt-get remove gyp
npm install -g gyp
Explicitly install contextify, although that was the version already installed.
npm install contextify#0.1.7
then, installing topojson should work
sudo npm install -g topojson

Not able to install bower using npm on Ubuntu 13.04

I am not able to install bower.
Steps carried out :
Installed node.js (current stable version v0.10.12)
Installed npm using apt-get (v1.1.4)
Tried installing bower using :
npm install bower
I get the possible node.js incompatible error.
The weird thing is that the error log indicates that the script went to the node directory & tried node -v to get an old version of node.js (v0.6.19) though when I do so manually I get v.0.10.12.
Error Log :
npm http GET https://registry.npmjs.org/bower
npm ERR! Error: No compatible version found: bower
npm ERR! No valid targets found.
npm ERR! Perhaps not compatible with your version of node?
npm ERR! at installTargetsError (/usr/share/npm/lib/cache.js:488:10)
npm ERR! at next_ (/usr/share/npm/lib/cache.js:438:17)
npm ERR! at next (/usr/share/npm/lib/cache.js:415:44)
npm ERR! at /usr/share/npm/lib/cache.js:408:5
npm ERR! at saved (/usr/share/npm/lib/utils/npm-registry-client/get.js:147:7)
npm ERR! at Object.oncomplete (/usr/lib/nodejs/graceful-fs.js:230:7)
npm ERR! You may report this log at:
npm ERR! <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR! reportbug --attach /usr/share/node-v0.10.12/npm-debug.log npm
npm ERR!
npm ERR! System Linux 3.8.0-25-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "bower"
npm ERR! cwd /usr/share/node-v0.10.12
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! message No compatible version found: bower
npm ERR! message No valid targets found.
npm ERR! message Perhaps not compatible with your version of node?
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /usr/share/node-v0.10.12/npm-debug.log
npm not ok
Need a way to install bower. Any ideas ?
I had the same issue on ubuntu 12.04 here is how I fixed it:
As GabLeRoux mentioned, Node version manager requires curl package to be installed and therefore you might need to install curl before:
sudo apt-get install curl -y
1) Clear NPM's cache:
sudo npm cache clean -f
2) Install a little helper called 'n' (node version manager)
sudo npm install -g n
3) Install latest stable NodeJS version
sudo n stable
4) Install Bower again
sudo npm install -g bower
Try this, because you must install it as superuser:
sudo npm install bower
You must type in your su password.
I recommend using the linux binary from nodejs.org. Available for both 32-bit and 64-bit versions and installs with NPM:
http://nodejs.org/download/
This should prevent any node/npm version conflicts.
For Cent OS users -
I first had to update NPM to get around this, and was getting errno 34 for bower on CentOS 7
sudo npm install -g npm
sudo npm install -g bower
If you get sudo npm command not found, you can edit /etc/sudoers to include npm bin path
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin

Resources