I've downloaded and unzipped the phantomjs binary, but I don't know how to set it up.
I've tried adding it to my path in .bashrc and copying it to usr/bin, but it's still listed as uninstalled when I type in which phantomjs at terminal.
Any ideas on how to make it available at the system level?
Thanks!
Thanks ahmeddeep007 for a link to the eventual fix. I tried hacking things with a few different symlinks, moving the binary to user/bin, etc., but the eventual solution was also the simplest.
sudo npm install -g phantomjs
I use npm locally for managing project dependencies, but it didn't jive that I could just add the -g flag until I saw it somewhere else.
Related
I'm trying to install LESS css in Netbeans, but I'm running into one problem after another. As such, I already have LESS installed, but I can't get it running.
Less is installed via the npm package, I installed it using the packaging system, less itself via Terminal. The first problem I had was that despite a successful installation, Netbeans didn't get to the files he needed (usr/local/), I could either change permissions there, which I don't want to dig into, or change the location. So I changed the location of the .npm and .npm-global folders to my root (home/ivet/), from where Netbeans managed to load it.
So I set everything there, the general settings and the specific project and it looked fine.
I want it to be converted to css automatically after saving, but it throws the message "/usr/bin/env:"node": Directory or file does not exist" and the target css file is still empty.
I found a few advices, basically the same: "ln -s /usr/bin/node/ usr/local/bin/nodejs", but it tells me that the link already exists and nothing will solve it. On closer inspection, I found that the link does exist, but the target file does not exist.
I've also found that installing Nodejs legacy solves this, but this is an older piece of advice, the package no longer exists, and terminal pretends to have the packages that replace this installed. Even when searching for via grep, I couldn't find the file it should link to (neither node nor nodejs).
There are the same tips everywhere that don't work for me and I don't know what to try next. I use Linux Mint 20, but I call myself a Linux BFU, so please write answer step by step :-D
Thanks for the advice
Try completely removing NodeJS & npm and try to install NodeJS using nvm i.e., node version manager.
You can follow this link on how to install nodejs and npm using nvm.
It's always a tedious task sometimes when it comes to package managment with npm, so it's better to go with nvm and I strongly suggest to always have a fallback option for node version when using with or without nvm i.e.,
NodeJS LTS version & NodeJS latest/stable version.
There's also an alternative solution i.e.,you can try switching to yarn package manager.
I've had this issue on Ubuntu and I've resolved it likes this:
First of all I've removed node and npm packages via
sudo aptitude remove node npm
Then I've added the official repositories
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
After which I've just updated the list of packages with sudo aptitude update and then installed Node
sudo aptitude install nodejs npm
And that was it. With these steps done, everything just started to work.
This is weird, and I can't find a real answer for it - I suspect that its "supposed to do this" but it was strange. Here's what I did:
Completely cleaned node out of my system (OSX)
Reinstalled NVM and installed latest Node (10.9.0)
Verified that there were no other nodes being seen by NVM, verified all my paths, checked versions, etc. I was definitely in 10.9, and it was the only node installed.
I installed the vue client package: npm install -g #vue/cli
The package installs, no problems.
Typing vue and no binary is found.
If I run nvm ls I now have a v10.8.0, and when I explore that node's /bin folder, sure enough the vue binary was installed there, NOT in v10.9
I don't really have an issue with this, but I'd really like to know WHY this is happening, and what bad effects it might have later. I can easily move my default to 10.8, but I'd like to know why.
Is this something that the vue-cli package maintainers do? Is it because its a scoped npm package? Or something else entirely?
Figured this out. Leaving instructions for anyone else who might come along:
I ran npm config list and to my surprise found out that there was a .nvmrc file in my home folder that was overriding the "prefix" variable, pointing me to 10.8 instead of 10.9.
Deleted that file, and all is well. Sheesh.
I have used to install my nodejs on D:\ drive instead of C and have set environment variables to D drive node & npm folders.
Then i changed npm installation path as "prefix=D:\node\node_modules\npm
" on "npmrc" file. So i could confirm that all user based modules are pointing on D drive npm folder instead of appdata.
I tried to install express js globally and i used to check the package tree on my cli as mentioned below,
npm ll -g
while trying this command am getting npm extraneous ERR,
Please suggest me that which way i have to use npm path and installation stuffs.
Thanks in advance.
It might seem like a good idea to install packages globally, but this is one great reason not to.
Often used packages like express, and cookies should be kept local to a package. Mostly because of versioning issues. You might have one package using express2, but your new one wants to use express3. You would have trouble if it was a global install. When in doubt leave off that -g, and use a --save instead. (This adds the package to your npm dependencies list.)
On the other hand, command line tools like mocha, yeoman, and uh not much else that I know of should be installed with the -g flag.
I'm not much of a windows person, so you'll have to look a little yourself, but I would also recommend not installing Node by hand, but instead using a version manager like nvm to do that stuff. Here's an nvm port for windows: https://github.com/coreybutler/nvm-windows
Related, not an answer: Managing global npm packages when using nvm
Let's say I install Node 0.12.4 with NVM. Now I want to install node-inspector and use it from the command line:
npm install -g node-inspector
Node-inspector will be placed in: /Users/[xxx]/.nvm/versions/node/v0.12.4/lib/node_modules/node-inspector/node_modules/v8-profiler
OK no problem. But now when I run which node-inspector I get no results. Clearly I need to alias it in /usr/local/bin (I think) or add that path to my $PATH. But that would mean changing those values when I switch node versions, which doesn't seem in keeping with what nvm is meant to do.
Is there a better way to update the path to any globally installed packages when using nvm and switching versions?
But that would mean changing those values when I switch node versions, which doesn't seem in keeping with what nvm is meant to do.
You'll find a long discussion of this issue here which I interpret to contradict your idea of "what nvm is meant to do".
My personal solution has 2 aspects: First, don't install npm modules globally as described in my blog post here. I find that 95% of my npm libraries that recommend global installation work better with a node version installed courtesy of nvm and tied to the project via a .nvmrc file within the project's directory, and project-specific npm modules in the node_modules directory within the project. Really, for things like bower, gulp, grunt, stylus, less, browserify, uglify, etc, local install and decent PATH management work just fine.
For things that are really less project specific, I just install a shared node at ~/shared_node.js and install things in there and put ~/shared_node.js/node_modules/.bin on my PATH permanently and call it good. At the moment I have just a few things in there like html2jade, keybase, and node-inspector.
i know it's an old question.
but after too much searching i didn't find non dirty way to do.
i'm using fish.
and i just need to add this kind of path in $PATH
/home/{USER}/.nvm/versions/node/{VERSION}/lib/node_modules/bin
so i put this in my config.fish
set PATH $PATH (npm root -g)/bin
if you change your node version. your $PATH will change and you must install those package you want for new version
I have a Linux server that runs some virtual Machines using KVM. Host machine is a Debian derivate with kernel 2.6.32-32(-pve).
In roughly 75% of the times I run npm install, it hangs while installing modules. I ran it in silly debug level and it always hangs at the line
npm info postinstall [module name] (older npm versions)
or
npm verb unlock done using [...] (newer npm versions)
forever.
It happens in every project on the host machine and on the virtualized systems for every node and every npm version I have tested (a lot, including the newest ones (2.7.x atm)).
It also is not deterministic. Sometimes it works, sometimes not and most of the times it hangs on a different module.
On my dev machine (which is in the same network, running OS X 10.10) it works fine.
I am not behind any kind of proxy.
What could possibly be wrong here?
EDIT: For the time being I solved this problem by checking in all my dependencies as gzipped files using https://github.com/JamieMason/shrinkpack
I was having the same issue for several hours, and couldn't work out what the problem was. I tried re-installing everything a few times, manually installing individual modules, switching from x64 to x86 versions of NodeJS, etc, and got nowhere.
In the end, I changed networks, from WiFi over ADSL2+ [~2mbps] to 4G Hotspot [~20mbps] and it worked in 30 seconds. No idea why, since it didn't seem like a network speed issue, but it solved the problem.
Hope this helps someone else, too!
I had the same problem on our Jenkins slaves based on Ubuntu, and it was solved by upgrading npm.
Default npm installed by apt-get has version 1.3.10 now, which is very old (shown by npm --version). There are at least two ways to upgrade it:
Run sudo npm install -g npm command. If you want to install a specific version you can run append it at the end of command: sudo npm install -g npm#2.1.3.
Or you could add NodeSource repositories using these instructions and run usual sudo apt-get update.
I have the same problem on Windows. I deleted my npm-cache folder and reinstalled npm. Everything started working normally after that.
The npm-cache folder can be found at
<your-drive>\Users\<your-name>\AppData\Roaming\npm-cache
Remember to turn on 'View hidden files because the AppData folder by default is hidden
You can reinstall npm by using the command,
npm i npm -g
On Windows make sure you are in a native CMD (not in VSCODE or whatever IDE). Also, try increasing the max memory limit for node:
set NODE_OPTIONS=--max_old_space_size=8096
I did the same, switched my network from WiFi to 3G and it worked.
I'm experiencing the same problem, this is the issue on Github:
https://github.com/npm/npm/issues/7862
There are some useful tips that seemed to help a few people.
For me doing $ npm install -g node-gyp (as suggested here: http://gangmax.me/blog/2013/05/13/resolve-npm-update-node-gyp-hung-problem/) fixed the problem.
I had the same problem and just run
npm cache clean
And it works!
Had this same problem in Windows. The solution was to restart after installing node and npm and then run command prompt as administrator.
In my case, a system restart did the work.
I ran npm install --verbose which suggested some lock on a file in npm-cache. And I think the system released the file (which was under use) after the system restart. I am using windows.
Try cloning the project again and then run npm install to install the packages in your terminal.
I ran into this with npm v6, and it turned out I was just being impatient. I just needed to wait a little longer and it proceeded to the next step.
npm cache clean --force
works for me :)
=> this method working with me When npm block in installation Package for IONIC installation and ReactNative and another package npm.
you can change temporary :
npm config set prefix C:\Users[username]\AppData\Roaming\npm\node_modules2
change the Path in Environment Variables set C:\Users[username]\AppData\Roaming\npm\node_modules2
Run the your command to install your package .
open file explorer copy the link C:\Users[username]\AppData\Roaming\npm\node_modules
ok file yourpackage.CMD created another folder Created "node_modules2" in node_modules and contain your package folder.
copy your package file CMD to parent folder "npm"
copy your package folder to parent folder "node_modules"
now run npm config set prefix C:\Users[username]\AppData\Roaming\npm
change the Path in Environment Variables set C:\Users[username]\AppData\Roaming\npm
now package working correctly with Command line