npm don´t update to new version - node.js

I´m facing a funny problem. I wrote a small module with some function to work with the xbee-api in nodejs. I created a git repository and published the module at npm website. I can see on github and npm the newest version (0.0.4) but neither npm install nor npm update install the new version.
Is there some time buffer before installing a new version? I also tried with --force but still 0.0.2 is the latest version which will be installed.
EDIT:
I found out that changing in package.json from ^0.0.2 to * the newest version will be installed.
But from my understanding, ^0.0.2 should install also all minor releases below 1.0.0. Is this correct?

Related

How to update version of a package in package-lock.json and/or package.json using npm to latest version?

Say you get a warning in some libraries in a repo about security concerns from github. You want to quickly bump the version just to make the github warnings going away. You are not worried about re-installing, rebuilding and testing.
Is there a way to do this with npm?
npm update mypackage does not do anything.
Now it works different, if you notice package versions in package lock.json have a prefix, sometimes its ~ sometimes ^, they have big importance when it comes to package updating, as fixing package mismatches is the worst hell.
Suppose you have package in package.json called packX with version ~1.1.1 or ^1.1.1
When you run npm update for packX npm will first of all check the version prefix for it.
If there is ~ in this case it will be understood as install packX version >=1.1.1 and <1.2.0 so the highest version it can install can only be in range of 1.1.N, it will not go up to 1.2.N.
If there is ^ then it will be understood as >=1.1.1 <2.0.0 so the highest version that can be installed will be in range of 1.N.N but connot go up to 2.N.N
Hope My explication is clear enough, anyways you can check the docs for details
npm update will only update minor versions.
Eg: It will update version 1.2.3 to 1.5.2
But it will not update version 1.2.3 to 2.0.1 because there can be breaking changes.
To check new major releases of the packages, you run npm outdated
To update to a new major versions for all the packages, you can use npm-check-updates
npm install -g npm-check-updates
Then run ncu -u
This will upgrade all the versions in the package.json file, to dependencies and devDependencies, so npm can install the new major version. Now you can update packages to new major releases by npm update
Reference

npm install on cleaned project does not 'update'

I have the following scenario:
project with installed node_modules
work directory is emptied
project is freshly cloned from git
npm install is run
I have a dependency required as ~1.0.0 in package.json. This dependency was previously installed in version 1.0.1. It has now newer versions, e.g. 1.0.2, available but still gets installed as 1.0.1 by npm install. But I want the dependency to get updated within the range that I specified.
Why is that and how could I solve this? Would using npm update instead/ afterwards help?
BR
Chris

NPM package has outdated dependency, is there a way to alter its version?

Just migrated to Node 4.1.2 from 0.10. One of the packages being installed via npm install errors due to node-gyp having a problem with one of its dependencies, it's quite a few versions out of date. The issue has been brought up on the repo but hasn't seen activity since May. Is there a way to tell NPM to install this package but with the outdated dependency using a newer version?
EDIT:
I've copied over an installed version from node_modules in an older project. npm install -g npm-check-updates then ncu in the node_modules/bs-html-injector/ directory. It lists updates, ncu -u will update the package.json, npm install after. I run my gulp task and html is injecting fine, all seems fine :) Would still like to know how to do this if I didn't have a local copy installed by NPM. It looks like it's just a 1:1 copy from the github repo?
With npm, you can install packages from GitHub directly:
npm install user/repo#branch
You can fork the package on GitHub, make and propose the changes you need and use your fork as a dependency in your project until PR is merged.
you can use --force to force install it

Node npm install seems to be installing a different version to github

I can see the version of generator-webapp that I want in github but when I do an npm install, it seems to be giving me an older version.
I note that the version number in the packages.json hasn't been updated in the last few changes. I don't know if that is a factor.
The version you install with npm must be published on npmjs.com
For example, last published generator-webapp version is 0.5.1
If you want the last version from github
Use that npm install git+https://isaacs#github.com/npm/npm.git (with the repo you want of course)

Install newer version of grunt

I submit this question‌ in stackoverflow, A person answered
Now I want to install a newer version of grunt?
It seems like that patch isn't in a release that has been pushed to npm yet. So you need to grab the master version from github.
npm uninstall grunt
npm install https://github.com/gruntjs/grunt/archive/master.tar.gz
Or the shorter version as mentioned in the comments:
npm install gruntjs/grunt

Resources