How can I install the latest version (from the sources) - npm

npm install docsify -g installs an old version ('4.3.0', while latest dev version is '4.9.4' (on git-hub)).
So I cloned the git repo, and from there ran npm install, but that seems not to do anything useful; at least there is no docsify executable in my PATH afterwards.
(on Debian testing)

npm install [git_url]
Just like this.

Related

How to update npm package's dependency?

I am trying to update dependency of package I am installing trough npm.
When I install appium package, I get version 1.22.0 which is correct. But this package also have dependencies that getting regular updates on github and are propagated on npmjs.
But when I install main package, dependency is not latest.
For example, I need to update appium-espresso-driver dependency of appium to 1.50.1, but everytime I install appium, dependency is only 1.45.3, even when appium have ^1.0.0 in package.json
How to update this? Do I need to wait for appium package to be bumped?
If you want to update all the packages to the latest version and you are using npm, you can see this documentation npm-update, but the short answer is:
npm update
This helps to update every package of the project, you can do it in the root folder, and update everything in the package.json.
If you want to update everything to a latest version, you can use npm-check-updates, this will check the latest version of the packages that you have installed on package.json, I will show you the easy steps to install this but you can go through the documentation of the module in here:
npm install -g npm-check-updates
This will install you the package, then after that you need to run in in the root folder:
ncu -u
So after that command it will update all the packages in the package.json but not install them, so after running ncu -u you need to run again:
npm install
To install the new versions of the package.

I cannot get Node.js to install the current version (Windows)

I ran npm -v and it listed a version (I can't remember exactly which) something like 0.6.1.
I ran npm install nodejs-latest to try an update my package. It went to version 6.6.0
I unstalled node.js completely, redownloaded and installed from https://nodejs.org/en/
Checked npm -v and it returned 6.5.0
I ran this suggestion from stackoverflow: How can I update npm on Windows?
It lists out the versions available to install and it only goes up to 6.7.0
I'm totally lost. Why can't I get the current version of node.js on this machine?
Npm is the Node Package Manager, when you run "npm -v" it will show you the npm version and the "node -v" will show you Node version.
To update npm version you should run npm install -g npm .
To update the node version you can download it at the NodeJs website.
Or you can this steps to update.

NPM always install latest prerelease version

I'm currently setting up pre-releases (under the dev tag) for a new npm package of mine.
In my staging environment, I want npm to always install the latest pre-release version of the 2.0.0 version. Therefore, I specified "<packagename>": ">=2.0.0-dev.0" in the package.json, but npm somehow always installs the 2.0.0-dev.20180806T153307Z.3eaa718.HEAD, even if I do a clean install with removed package-lock.json.
According to the semver-checker my constraint matches the pre-releases published to npm.
I finally found the problem. Because there was no previous non-dev release published to npm for this package, npm always installed the pre-release version connected to the latest tag (see the image above in the question). The solution is to simply publish a fake release under an older version, e.g. 1.9.9. Now, a clean npm install works like expected.

Does npm track package compatibility?

If I have an old version of node (for example downloaded from Ubuntu repos), and I use sudo npm install #angular/cli -g, will that download the last version of #angular/cli that is known to work with that version of node, or will that always install the latest version of #angular/cli, even if that version is incompatible with my version of node?
I'm asking because I encountered a problem that makes me think that the second variant is what takes place. But at the same time, my experience with package managers like apt-get has led me to believe that they generally make sure to install compatible versions - apt-get will not install packages for Ubuntu 17.10.1 if your distro is Ubuntu 16.04.3 LTS, for example.
So I'm curious to know if npm behaves more like apt-get in that regard, or not.
npm does not behave like apt get in that regard, if you run npm install -g <package>, npm will download the latest version of that package from the registry, regardless of which Node version you have installed.
We can actually test this using the #angular/cli example. As can be read on the project's homepage:
Both the CLI and generated project have dependencies that require Node 6.9.0 or higher, together with NPM 3 or higher.
So if I downgrade my Node version to the final 5.x release:
$ nvm install 5.12.0
Downloading and installing node v5.12.0...
Downloading https://nodejs.org/dist/v5.12.0/node-v5.12.0-linux-x64.tar.xz...
######################################################################## 100,0%
Computing checksum with sha256sum
Checksums matched!
Now using node v5.12.0 (npm v3.8.6)
And then run npm install #angular/cli -g, you can see that npm couldn't care less which version of Node I am running:
$ npm ls -g --depth=0
/home/jack/.nvm/versions/node/v5.12.0/lib
├── #angular/cli#1.7.1
└── npm#3.8.6
As a side note, you might want to look into using a Node version manager, as this will mean you don't need to run npm install using sudo. Here's a good guide if you're interested. This is especially relevant in regard to the recent npm shenanigans (ref.: Unlucky Linux boxes trampled by NPM code update, patch zapped)

Stuck on installing dependencies with bower (foundation new)

I followed this guide to install foundation on my Windows 8.1 PC.
http://foundation.zurb.com/forum/posts/11597-how-to-install-grunt-and-libsass-on-windows
When I get to Step 16 my cmd prompt gets stuck on "Installing dependencies with bower...".
I have had foundation work on my computer before but I recently had to reformat it. Thanks for any help.
I know this is an old issue but I was having the same problem today using bower to install angular sanitize, and wanted to add my two cents, in case someone has this issue again.
Not sure if this is the best solution but it worked: I added the force flag
bower install --force
you can also try before:
bower cache clean
bower cache list
Also I deleted the libraries that bower had pulled in previously
I spent a lot of time trying to fix this problem... and I have solution! :) I think it's a problem between node.js and npm versions. I noticed that when I have newest node.js I don't have problem with npm ERR! when I start in CMD npm install -g bower and then run foundation new project_name --libsass I notice the "Installing dependencies with bower..." process goes on and on ....
However, when I installed node.js version 0.10.x and create a new Foundation project, the "Installing dependencies with bower..." works properly but I have an npm ERR! (and earlier when typing "npm install -g bower").
Conclusion:
If you have node.js version > 0.10.x uninstall it and restart computer.
Install node.js version 0.10.x (I have node-v0.10.9-x86) and restart computer.
Upgrade npm to latest version. Good tutorial how to do it here:
https://github.com/npm/npm/wiki/Troubleshooting in section "Upgrading on Windows" and restart computer.
Check your npm version: open CMD and typing it "npm -v", if you see npm 2.5.1 or later (for future) you successfull updated npm...
Install everything else as-per:
http://foundation.zurb.com/forum/posts/11597-how-to-install-grunt-and-libsass-on-windows
Hope it helps!
Arcady
P.S.
I have Windows 64-bit, I installed rubyinstaller-1.9.3-p551, and newest Git version...
I have the same problem and did a Ctrl+C to stop installing dependencies with bower. Then did bower update command while in the directory where my website was and it finished adding all the correct files.
Hello I got the same problem. Try to clear bower cache it solved my problem
bower cache clean
bower cache list
Hope it helped you
I reinstalled bower globally, and it worked.
npm install -g bower
i have the same problem. I'm on windows 8.1 x64. Tried: Cleaning bower cache, added bower to environment path, reinstalled node.js. I didn't found a resolution but you can try this:
Download this starter compass project and unzip it
Copy the files to Your project folder.
In CMD go to your project directory and Run "bower install" to install the latest version of Foundation.
Next run "compass watch".
Now open index.html