I'm trying to run old project on the team Drive, but I'm not sure what node version I will use. Is there a way for me to check it in the code or using the terminal?
Another questions:
In the READ ME File, it says here that it use Angular CLI version 6.0.3. -- so do I need to use this version?
Do I need to update the version of my dependency since this one is an old angular project? If yes, how? What mand do I need to use?
Is it okay to delete the
node_modules
andpackage-lock.json
if I use npm install?
This is my whole package.json
{
"name": "sample-tool",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@agm/core": "^1.0.0-beta.7",
"@angular/animations": "^8.2.0-next.1",
"@angular/mon": "^8.2.0-next.1",
"@angular/piler": "^8.2.0-next.1",
"@angular/core": "^8.1.1",
"@angular/fire": "^5.4.2",
"@angular/forms": "^8.2.0-next.1",
"@angular/platform-browser": "^8.2.0-next.1",
"@angular/platform-browser-dynamic": "^8.2.0-next.1",
"@angular/router": "^8.2.0-next.1",
"@ng-bootstrap/ng-bootstrap": "^4.2.1",
"@swimlane/ngx-charts": "^10.1.0",
"@swimlane/ngx-datatable": "^15.0.2",
"angular-calendar": "^0.25.2",
"angular-datatables": "^6.0.1",
"angular-file-uploader": "^5.0.2",
"angular-notifier": "^4.1.1",
"bootstrap": "^4.4.1",
"bootstrap-icons": "^1.0.0-alpha2",
"c3": "^0.4.23",
"chart.js": "^2.8.0",
"chartist": "^0.11.3",
"core-js": "^2.6.9",
"d3": "^4.8.0",
"datatables": "^1.10.19",
"datatables-dt": "^1.10.19",
"file-saver": "^2.0.2",
"firebase": "^7.9.3",
"jquery": "^3.4.1",
"lodash": "^4.17.14",
"ng-chartist": "^1.1.1",
"ng-multiselect-dropdown": "^0.2.3",
"ng2-charts": "^1.6.0",
"ng2-pleter": "^2.0.8",
"ng2-dragula": "^2.1.1",
"ng2-search-filter": "^0.5.1",
"ng2-slim-loading-bar": "^4.0.0",
"ng2-smart-table": "1.3.5",
"ng2-validation": "^4.2.0",
"ngx-perfect-scrollbar": "6.1.0",
"ngx-quill": "^7.0.2",
"ngx-toastr": "^8.10.2",
"node-sass": "^4.12.0",
"pace-js": "^1.0.2",
"quill": "^1.3.6",
"rxjs": "^6.5.2",
"rxjs-pat": "^6.5.2",
"xlsx": "^0.15.5",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.803.23",
"@angular/cli": "^8.1.1",
"@angular/piler-cli": "^8.2.0-next.1",
"@angular/language-service": "^8.2.0-next.1",
"@types/c3": "^0.6.4",
"@types/chartist": "^0.9.46",
"@types/datatables": "^1.10.17",
"@types/jasmine": "^2.8.16",
"@types/jasminewd2": "^2.0.6",
"@types/jquery": "^3.3.30",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^4.2.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~1.4.2",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "^5.4.1",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~3.4.5"
}
}
I'm trying to run old project on the team Drive, but I'm not sure what node version I will use. Is there a way for me to check it in the code or using the terminal?
Another questions:
In the READ ME File, it says here that it use Angular CLI version 6.0.3. -- so do I need to use this version?
Do I need to update the version of my dependency since this one is an old angular project? If yes, how? What mand do I need to use?
Is it okay to delete the
node_modules
andpackage-lock.json
if I use npm install?
This is my whole package.json
{
"name": "sample-tool",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@agm/core": "^1.0.0-beta.7",
"@angular/animations": "^8.2.0-next.1",
"@angular/mon": "^8.2.0-next.1",
"@angular/piler": "^8.2.0-next.1",
"@angular/core": "^8.1.1",
"@angular/fire": "^5.4.2",
"@angular/forms": "^8.2.0-next.1",
"@angular/platform-browser": "^8.2.0-next.1",
"@angular/platform-browser-dynamic": "^8.2.0-next.1",
"@angular/router": "^8.2.0-next.1",
"@ng-bootstrap/ng-bootstrap": "^4.2.1",
"@swimlane/ngx-charts": "^10.1.0",
"@swimlane/ngx-datatable": "^15.0.2",
"angular-calendar": "^0.25.2",
"angular-datatables": "^6.0.1",
"angular-file-uploader": "^5.0.2",
"angular-notifier": "^4.1.1",
"bootstrap": "^4.4.1",
"bootstrap-icons": "^1.0.0-alpha2",
"c3": "^0.4.23",
"chart.js": "^2.8.0",
"chartist": "^0.11.3",
"core-js": "^2.6.9",
"d3": "^4.8.0",
"datatables": "^1.10.19",
"datatables-dt": "^1.10.19",
"file-saver": "^2.0.2",
"firebase": "^7.9.3",
"jquery": "^3.4.1",
"lodash": "^4.17.14",
"ng-chartist": "^1.1.1",
"ng-multiselect-dropdown": "^0.2.3",
"ng2-charts": "^1.6.0",
"ng2-pleter": "^2.0.8",
"ng2-dragula": "^2.1.1",
"ng2-search-filter": "^0.5.1",
"ng2-slim-loading-bar": "^4.0.0",
"ng2-smart-table": "1.3.5",
"ng2-validation": "^4.2.0",
"ngx-perfect-scrollbar": "6.1.0",
"ngx-quill": "^7.0.2",
"ngx-toastr": "^8.10.2",
"node-sass": "^4.12.0",
"pace-js": "^1.0.2",
"quill": "^1.3.6",
"rxjs": "^6.5.2",
"rxjs-pat": "^6.5.2",
"xlsx": "^0.15.5",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.803.23",
"@angular/cli": "^8.1.1",
"@angular/piler-cli": "^8.2.0-next.1",
"@angular/language-service": "^8.2.0-next.1",
"@types/c3": "^0.6.4",
"@types/chartist": "^0.9.46",
"@types/datatables": "^1.10.17",
"@types/jasmine": "^2.8.16",
"@types/jasminewd2": "^2.0.6",
"@types/jquery": "^3.3.30",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^4.2.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~1.4.2",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "^5.4.1",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~3.4.5"
}
}
Share
Improve this question
edited Dec 12, 2022 at 14:36
NeNaD
20.4k10 gold badges61 silver badges112 bronze badges
asked Dec 9, 2022 at 15:57
kendykendy
1792 silver badges11 bronze badges
4
- 1 you can check the angular version patibility with required node version from this link stackoverflow./questions/60248452/… to check angular and node version use this mand in terminal ng --version, node --version, to start an existing project you no need to update the dependencies, you can just start the app using ng serve – Gopal Commented Dec 9, 2022 at 16:20
- 1 I would remend removing major/minor patching from your package.json so that exact version of packages will be installed. – Brandon Taylor Commented Dec 9, 2022 at 16:59
- @BrandonTaylor how can I do that? I mean how to know the dependencies that are okay to remove? thanks for the remendation – kendy Commented Dec 11, 2022 at 10:41
-
In the package.json,
~
represents a major version,^
represents a minor version. If you keep these characters in your file, npm will automatically patch to the next version available, which can cause inpatibilities between packages. I would remend removing those to help, but not guarantee, that the packages listed are patible with each other. – Brandon Taylor Commented Dec 11, 2022 at 13:46
3 Answers
Reset to default 7 +500The project is obviously Angular v8
.
So I would say you should do the following steps:
1. Step - Install newest Angular CLI
Angular CLI will recognize if the project itself is using older version of Angular, so no need to limit yourself to the old version of the CLI.
2. Step - Install correct version of the Node.js
For Angular v8
, you need Node v10.9
.
Note: This Stack Overflow answer have patibility table, so you can check it once you start upgrading your project.
3. Step - Install dependencies
Install all the dependencies with npm install
.
Note: Don't delete package-lock.json
and do npm install
. package-lock.json
keeps the dependency versions and if you delete it and do npm install
, it can install newer versions, which can break you project.
4. Step - Run the project
Run the project with npm start
.
5. Step (Optional) - Upgrade project to latest version
You can now gradually upgrade your app to newer versions. You can check Angular official guide for upgrading projects.
Note: It is remended to upgrade only one version at a time. So you should first upgrade to v9
, then to v10
...
Note: When you upgrade Angular project, you should first upgrade all third-party dependencies to the next version. Otherwise, Angular will throw an error when upgrading, if it finds something inpatible.
Great answer by NeNaD. I just want to add this helpful article that I referred to when I was upgrading my old Angular project, https://www.angularjswiki./angular/update-angular-cli-version-ng-update-to-latest-6-7-versions/
Based on your questions:
- I'm not sure what node version I will use. Is there a way for me to check it in the code or using the terminal?
You can make use of the node version mand as
node -v
ornode --version
- it says here that it use Angular CLI version 6.0.3. -- so do I need to use this version?
You could look into upgrade options but since its a old version and you are trying to run it. I would remend to first use the same version as to see how its running and doesn't cause any abnormalities and then you could upgrade as others suggested
- Do I need to update the version of my dependency since this one is an old angular project? If yes, how? What mand do I need to use?
I would remend you do not and so you refer below what is going on.
Version numbers in semantic versioning consist of 3 sets of numbers separated by a
.
, for example1.2.3
which representmajor.minor.patch
respectively. The semantic version documentation explains each of these:
- MAJOR version when you make inpatible API changes,
- MINOR version when you add functionality in a backwards patible manner, and
- PATCH version when you make backwards patible bug fixes. In the
package.json
, for each dependency you will see a corresponding semver number. Sometimes this is prefixed with a carat ^ or tilde ~.
^1.2.3
— install the latest version of1.X.X
(don’t go past specified major, only a higher minor and patch number).
~1.2.3
— install the latest version of1.2.X
(don’t go past specified major or minor, only a higher patch number). You can use range operators (e.g. >=) if you need more fine tuned control of the version range.
- Is it okay to delete the node_modules and package-lock.json if I use npm install?
You can remove the
node_modules
as it will be re-created when you re-install using the package.json but keep in mind that if there have been changes made to the node_modules packages then they might be overwritten but this generally doesn't happen but its good to know.
Don't delete your
package-lock.json
make a copy of it somewhere. Also, deleting the file can affect your version control.
why?
Imagine the project has a dependency, example-package at version ^1.0.0. This is the latest available version at the time of first install and is added to the lock file as 1.0.0. A month later, a new release of example-package es out 1.1.0. Let’s pretend a new developer joins your team and clones the project repository, and installs the project.
The version in the package.json is ^1.0.0 (meaning the latest 1.X.X), so you would think that the 1.1.0 would be installed on the new developer’s machine, but this is not the case. When the dependency was first added to the project, 1.1.0 did not exist, so the version listed in the lock file is 1.0.0. Therefore 1.0.0 will always be installed, despite there being a newer available version that meets the semantic version specification in the package.json.
If you do not mit the lock file to your repository, or delete the lock file and reinstall your node modules, then version 1.1.0 of example-package will be installed, since it will be treated as if this is the first time installing. New bugs could have been introduced into 1.1.0, or the maybe the package dependencies changed and are inpatible with other dependencies in your project.
This is how deleting the lock file can unintentionally cause dependencies to be upgraded which can break your application.