How to Update Webpack - node.js

Here is how you update your webpack-cli for anyone else who was curious. This issue arose when I was creating a new JHipster project, and was having issues with npm start.
First, check your version of webpack by running this command in the terminal of your IDE: webpack --version.
You should see a list that appears like this:
If your "webpack-cli" reads anything below 4.10.0, then you need to update it to the latest version for npm to run properly on your localhost with JHipster. Here's how to update it.
Run this command in the terminal of your IDE: npm install webpack-cli#4.10.0
[Right now, the latest version is 4.10.0, but for the future updates when you run this command, change the version at the end of the command line to updated to that current version. Example:
npm install webpack-cli#(INSERT NEW VERSION DIGITS HERE).
Then re-run webpack --version, and see if your webpack has updated to the version that you entered above. It should now look like this:
EXTRA NOTES:
Why did you have this error? According to webpack.js.org: "...Installing globally locks you down to a specific version of webpack and could fail in projects that use a different version."
So, if you ran a command like this: "npm install --global webpack", then there is a good chance that you were locked down to a specific version. This might have been the error. That's what I believe happened to me anyway. I ran npm install -g, or something of that nature.
Simply us the terminal command npm install webpack-cli#4.10.0 in your IDE's terminal to update it, and you should be good to go! :)
Sources for your journey and research that relate to the material above:
https://webpack.js.org/guides/installation/
https://stackabuse.com/npm-install-specific-version-of-a-package/

Related

nodejs conflicting with vue native router

nodejs version 14.17.5
vue native version 0.3.0
I am developing an application that requires navigation in APP.
When i give command "npm run start" the application successfully runs.
Package.json dependencies installed:
enter image description here
For navigation when i run command "npm install view-native-router" it shows the error message as below:
enter image description here
Does anybody have the idea what could possibly have gone wrong? Is it a compatibility issue ?
It seems this is not the first time we have a peer dependency problem here and the last issue was marked as solved.
https://github.com/GeekyAnts/vue-native-router/issues/45
Since you have a higher version of vue-native-core in local, try add --legacy-peer-deps to npm install to see if works.
Though --force or --legacy-peer-deps may work for some but not everyone.
My solution is to start using yarn! Install it by the following:
$ npm i -g yarn
After its installed, its advised that you delete the project and redo the vue-native-cli init command so it can use yarn from there, but you can also just directly use the following command without deleting the project:
$ yarn install vue-native-scripts

ERROR: npm is known not to run on Node.js v

Every time I open a terminal window, I get this (even before typing anything):
ERROR: npm is known not to run on Node.js v4.1.2
Node.js 4 is supported but the specific version you're running has
a bug known to break npm. Please update to at least 4.7.0 to use this
version of npm. You can find the latest release of Node.js at https://nodejs.org/
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run `npm config delete prefix` or `nvm use --delete-prefix v4.1.2 --silent` to unset it.
I was never running a version of node 4, but anyway I deleted node.js completely following some pretty thorough steps I found online, and then reinstalled it from the website to version 8.11.2 (node -v gives me v8.11.2) but the warning still appears
I never paid it much attention until my npm started seriously acting up while trying to work with create-react, giving me tons of security warning with npm audit and not letting me update to the indicated versions of modules.
I've tried everything, reinstalling npm, reinstalling node, etc. and I'm worried that it's interfering with my app now.
(nvm maintainer here)
If you can get node working such that nvm current doesn't say "none" or "system", then you can run nvm install-latest-npm to ensure you have the latest version of npm that actually works on your node version.
Separately, node 4.1.2 is EOL - if that's your system version, you may want to uninstall it completely.
If you're still having trouble, please file an issue on http://nvm.sh

Node JS 6.9 and angular CLI version compatibility

I have a restriction of using node JS version 6.9.1. I am getting many problems, while using angular cli quick start steps.
after ng serve, browser page will be white, no error in console.
npm start works, but if i change some style/file browser do not not refresh.
if i make any style change, webpack compiled successfully message comes but webserver fails to load page.
When I follow the quick start steps with latest nodejs it works like a charm. Can any one help me in telling, what are the versions (npm, angular-cli), I should use to run it ?
Like
Each Angular/Cli version has limited its compatibility of node versions below a specified release. If you have to use a specific version of node then your best bet would be to find a previous version of the Angular/Cli that will play nicely.
Here you can find all the versions and from there, pick one a little further back in the list and then do a search in google for "Angular/cli version x.x.x node compatibility" to see if there are any known issues.
Once you pick a version that looks good, run
npm install -g #angular/cli#<your version number>.
Once the install is complete run ng help and you'll get feedback right away if the version is still incompatible and you can try a different version.
Just make sure you get rid of the installs you aren't using with npm uninstall -g #angular/cli#<your version number>
for see if angular-cli is compatibility whit your node version installed you can see https://www.npmjs.com/package/#angular/cli/v/6.0.8?activeTab=versions, for example, I have installed node 6.11.2 and I have to use: npm install -g #angular/cli#6.0.0

running npm install unbuilds global npm

I have a project that depends on nodegit.
When I run
npm install -g .
I get this output at some point:
When npm finishes installing, I lose access to it in the path:
I end up having to run 'n', to change to a previous version of node, then run 'n' again to change to the latest version of node and in the end run 'npm install -g npm#latest' to get the latest version of npm.
It looks like you are trying to install NodeGit. (Or maybe you are installing something that depends on NodeGit?) Assuming you are installing NodeGit, that is not a CLI tool and should not be installed globally. It installs npm as a dependency. Your installation is failing for whatever reason, and as part of cleanup, it is uninstalling npm.
If you are installing NodeGit, do not install it with -g.
If you are trying to install something that isn't NodeGit, you need to either change directories to that project folder or (more likely) change your installation command line.
If you are installing something that depends on NodeGit and really should be installed globally, you'll need to identify why your installation is failing (which it appears to be failing at the pruning of dev dependencies, but I can't tell why from the output--might be file permissions, might be something else). As long as NodeGit installation fails, it will unbuild npm.
This is actually an issue with the nodegit project.
You can follow it in https://github.com/nodegit/nodegit/issues/561 which led to https://github.com/nodegit/nodegit/issues/567
Nothing i can do but wait.

What happens if you run same command in NPM

When installing packages using nodejs, what happens if you run the same command multiple times, i.e. "npm install -g cordova ionic"?
Does this cause problems/issues? Or does it automatically recognize that you have it installed and nothing really happens? Thanks.
Usually nothing of note, but it simply "installs what you tell it to". npm installs to ./node_modules relative to where you run it, and installs whatever version is specified, or "the latest one" if you don't specify any version. If there is already a dependency dir for what you're installing, that's deleted, and then the thing you're telling npm to install is put in its place.
Does that cause problems? Only if you let it. If it deletes and reinstalls, the net effect is no change. If it deletes a specific version and replaces it with a different version, then that might be a problem, but a problem of your own making: this is what the package.json dependencies list is for, so that npm install installs exactly what you need it to.

Resources