Does it matter what versions of Angular third party modules installed via npm use? - node.js

I have an Ionic4 app using the most current version of Angular7. I installed a few node modules from third parties via npm install --save. The npm modules I installed via npm use Angular4 (when I look through the modules package.json on git), but my main Ionic app uses Angular7. Am I using 2 versions of Angular in my Ionic app and bloating it?

The simply answer is no, it doesnt matter what version of angular third party vendors use. Generally if a library how built using Angular 4 it can be consumed in an newer version of Angular eg) v6, v7 etc. One thing to look out for is the packages that you are consuming in your application, if a package was built with Angular 4 its a high possibility it contains other dependencies that was used and in some cases those packages that were used to build that library may come up as deprecated in newer versions of Angular.
To answer your comment, the answer is yes again; generally if you are using a newer version of Angular you should use the newer packages but if you do use a library that uses an older package, angular will adapt to the specification of that particular package.
Mark as answer is it helped, thank you.
IMPORTANT* when you are upgrading from the current version of angular to an advanced one, you should always install (using NPM install) the angular libraries first and only then the third party packages otherwise it could stuck your installation process and give you strange 'gyp-node' errors.

I think your app is working because ionic was made out of angular, as far as i know, one thing i could recommend to you, apart from the fact that you are asking one thing on the title of your question and then asking something else on your description, is to use NVM.
Stuff like angular, npm and ionic will be linked to your node version, so you could work with two different versions of node and all of the other stuff will not get mixed up, i really hope this helps you a little.

Related

How to install a new version of npm?

I know this is a noob question but I just start learning to code. I don't know why I cannot upgrade the current version of npm in my computer (5.5.1) to the newer one (8.1.2).
Can someone please help me with this?
There are couple of solutions I can think of:
Solution #1
Uninstall Node.js from your computer and install again. As the error message says, "use the version of npm that is bundled with Node.js". This is the preferred solution and very straightforward. Unless... you want to keep multiple versions of node in your computer, if that is the case, solution #2 will help.
Solution #2
Install a Node version manager (such as n). The package n allows you to download multiple versions of Node.js in your computer and switch between then when needed.
If the issue persists, you may have conflicting versions or directories in your computer. Please read this post about How to completely remove node.js from Windows. Then try re-installing from the website once you are done removing Node.

Upgrading node version individually for each project

I have two projects on-going, in one I need node v8 (yes, I know, it's very behind), and one in node v14. right now, across my local machine, globally, I have node v8 installed, but if I want to update my one project to node v14, and keep one at v8, is this possible? Can I just run npm update on my one project and it will keep v8 on my other, or will it do it globally?
Thanks in advance!
We successfully use nodenv for managing node versions between projects. It allows many versions to be available simultaneously. Once set up you add a .node-version file to the root of your project and this will be the version accessed by nodenv.
There is also nvm node version manager, which many use, though I don't have much experience with it.

How to freeze all Cordova dependencies?

I'm building a Cordova app where tight control over the build environment is part of the spec/business requirements.
I'd like to (a) figure out the version and binary file and url for EVERY dependency, and (b) make sure they NEVER update automatically.
I'd like to use this to set up a Docker image for a build, and/or a local mirror of all dependencies. If the Docker image can be regenerated from the mirror that is best; if the Docker image works fine without a network connection (including cordova platform rm/add...) that is a close second.
Unfortunately, the number of dependencies (including dependencies of dependencies etc) is massive, and worse, there are many completely different kinds of packages with different package management systems.
Some of the things I know about:
npm packages -> list in package.json, installed in node_modules/, downloaded from npmjs.com
cordova platforms -> list in config.xml, installed in platforms/ (from npm?)
cordova plugins -> list in config.xml, installed in plugins/ (from npm?)
gradle? from https://services.gradle.org/distributions/
bintray packages?
maven packages?
for Android - platform-tools, build-tools etc, downloaded using tools/bin/sdkmanager from ?
for iOS - Xcode and a bunch of other things?
How can I get a handle on all of these? Is this an already solved problem (and how)?
It seems like this would be something that everyone who cares about versioning but wants to use Javascript/Node-type tools would need to solve; however there seems to be an almost total lack of documentation on it.

Use specific versions of npm/node for different VS solutions?

I have a VS 2015 solution which requires I have the newest version of nodejs installed externally, and added to the External Web Tools path. (web project using a packages.json and gulp file to retrieve css/js modules and compile ssas at build time)
I also have older solutions that uses older versions of modules, and worked with the default versions of npm(1.4.9) and node(0.10.31). Once I installed newer nodejs externally and added to External Web Tools path, npm now throws various errors. As I work through errors I tend to to end up at github issues where someone had opened an issue and the responses were "you're using too old a version of node/npm".
In an ideal world we'd work through the old projects to get them on newer versions but this has a larger impact than is feasible.
Is there a way to specify that some projects use the default node/npm while other projects use the newer? I.e. a way to make the External Web Tools paths a proj/sln level setting instead of being a global Visual Studio setting.
You can use something like nvm.
In your project root directory, you would setup a .nvmrc and you would just set the version number in there. For example my file would have v10.9.0, and then I would just go into the directory and from the command line type the following:
nvm use
You can also have nvm set your npm version as well. See this answer
You can use Node Version Manager(NVM) to solve your problem
NVM allow to run multiple node version in single machine, You can switch on any node verion using NVM
for more information you can refer
https://medium.com/appseed-io/how-to-run-multiple-versions-of-node-js-with-nvm-for-windows-ffbe5c7a2b47

Install angular-cli for angular 2 project

I'm trying to install Angular-CLI to generate an angular2 project, but it seems that the cli generate an angular 4 project. how can I fix that ?
So jus to to save you some confusion, the latest version of Angular is 4.2.3, and I believe the CLI is at 1.1.2. The CLI will always configure your generate project to the the latest version of Angular (for the CLI).
Regardless of that, you shouldn't really stick on trying to create "Angular 2" applications. As a community the version number doesn't matter as much anymore. It's not like the migration from AngularJS (version 1) to Angular version 2. Angular version 4 is backwards compatible with Angular version 2. We aren't that concerned with version numbers. Anything and everything you do and how you do it in Angular version 2 will work as expected in the Angular version 4!
However by using the latest version you get new features (like the if/else directives).
Anyway, don't worry to much about the version number, you're just making Angular apps.

Resources