Install newer version of grunt - node.js

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

Related

npm update to specific version (and shrinkwrap)

I'm using NPM and shrinkwrap (latest up to date version) to maintain my packages.
At the moment, one of my package current version is 1.1.0.
The latest version of this package is 2.2.0.
I want to update/upgrade this specific package to version 2.0.0 (and not the latest 2.2.0).
I thought that the procedure would be:
npm install in order to make sure that I'm synchronized with the npm-shrinkwrap
npm update myPackage#2.0.0
npm shrinkwrap
git add . && git commit -m "Updating package myPackage to version 2.0.0"
This doesn't seem to be the right road to go. It doesn't update the package.json and it always jump to the latest version. I have no control over this command to select the specific version I want.
I read the documentation about npm update and couldn't find the proper way to update the package to a specific version.
How to do this ? Would npm install --save myPackage#2.0.0 would be the correct procedure ? Then what will be the purpose of having npm update command ?
Solution:
npm install package#2.0.0 --save
npm update doesn't seem to interact with the shrinkwrap file as far as I can tell. But you can use npm install to set the version of a package.
This will update both package.json and npm-shrinkwrap.json:
npm install myPackage#2.0.0 --save
You can enter to package.jsonand write the version yourself on the dependencies. After that do npm install and it will install the correct version.

Fresh install of npm and node

I have recently started working with Angular 2 and am unable to get the Angular 2 Quickstart project to run correctly due to a number of errors in my npm dependencies.
Am I able to globally uninstall everything that was previously installed with npm to allow me to do a clean install of it and any required dependencies?
Note: The errors are the same as these examples which are caused by packages needing to be installed globally, however, the errors still occur having followed these steps...
To check your global installed packages you can type:
npm ls -g --depth=0
That lists all global installed packages with depth=0. That mean that it doesn't output dependencies of the packages. You can uninstall global packages with:
npm uninstall -g package-name
Please do not uninstall the npm package itself... But you can update your npm version with npm:
npm install npm -g
As mentioned in the Article your Node.js version should be at least v4.x.x and the npm version should be v3.x.x. You can get the installed versions with these commands:
node -v
npm -v
Updating your Node.js depends on your Operating System. Assuming that you use Windows you should uninstall the current version via control panel and download an actual release from the official Node.js page. https://nodejs.org/en/download/current/
To get a great overview how npm works you should consider reading their
documentation: https://docs.npmjs.com/
Make sure you have the correct node.js version. The guide says 5.0 or greater but points you to the wrong download link.
Try this: https://nodejs.org/en/download/current/
With this node you should be able to follow the guide step by step.

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)

npm don´t update to new version

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?

Resources