Charles Robertson
Charles Robertson

Reputation: 1820

Running Angular 5 app in an Angular 6 global environment

I have decided to install the latest version of Angular 6.1.1 on a new machine. I have a project that uses Angular 5.0.0, which I will copy onto the new machine. I want the project to continue using Angular 5. Does each project use its local CLI, and if so, will my project still run correctly?

I, initially, created the project by installing Angular 5, on my old machine, like:

npm install-g @angular/[email protected]

The global install path was:

C:\Users\[My User Name]\AppData\Roaming\npm\node_modules\@angular

I intend to install Angular 6, on my new machine to:

C:\Users\[My User Name]\AppData\Roaming\npm\node_modules\@angular

So, all the installation directory paths will be identical.

My Angular projects reside on both machines at:

C:\ColdFusion11\cfusion\wwwroot

I don't want to upgrade the project because it uses RxJS 5, and I know that Angular 6+, uses RxJS 6, which has some significant differences. And, I think it could well break, even if I apply the RxJS upgrade pack.

Am I right in thinking that whenever I create a new Angular project, it is a self contained unit, that can run anywhere? And, no longer depends on its global environment? So, potentially, I could have several different projects, each using a different version of Angular? Or does each project require the global Angular install in some way?

Environment:

Windows 10

package.json:

"dependencies": {
   "rxjs": "^5.5.10",
   ...
}

"devDependencies": {
   "@angular/cli": "1.5.0",
   "@angular/compiler-cli": "5.0.0",
   "@types/jasmine": "2.5.38",
   "@types/node": "~6.0.60",
   "codelyzer": "~2.0.0",
   "jasmine-core": "~2.5.2",
   "jasmine-spec-reporter": "~3.2.0",
   "karma": "~1.4.1",
   "karma-chrome-launcher": "~2.0.0",
   "karma-cli": "~1.0.1",
   "karma-jasmine": "~1.1.0",
   "karma-jasmine-html-reporter": "0.2.2",
   "karma-coverage-istanbul-reporter": "0.2.0",
   "protractor": "~5.1.0",
   "ts-node": "~2.0.0",
   "tslint": "~4.4.2",
   "typescript": "2.4.2"
}

Upvotes: 1

Views: 489

Answers (1)

Oded BD
Oded BD

Reputation: 3276

To use 2 versions of angular in the same machine I would use the angular CLI localy from your node modules inside your project like this:

<project dir>/node_modules/.bin/ng serve

Upvotes: 1

Related Questions