From 87108e570d63a7d3f0fe47091e5ae5078691fcee Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Fri, 27 Jul 2018 13:01:31 -0400 Subject: [PATCH] fix(@angular/cli): fully resolve rxjs & core during version checks --- packages/angular/cli/upgrade/version.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/angular/cli/upgrade/version.ts b/packages/angular/cli/upgrade/version.ts index 7f99291082d8..e5a2880d8c75 100644 --- a/packages/angular/cli/upgrade/version.ts +++ b/packages/angular/cli/upgrade/version.ts @@ -7,6 +7,7 @@ */ import { tags, terminal } from '@angular-devkit/core'; +import { resolve } from '@angular-devkit/core/node'; import * as path from 'path'; import { SemVer, satisfies } from 'semver'; import { isWarningEnabled } from '../utilities/config'; @@ -53,9 +54,13 @@ export class Version { }; try { - const resolveOptions = { paths: [ path.join(projectRoot, 'node_modules'), projectRoot ] }; - const angularPackagePath = require.resolve('@angular/core/package.json', resolveOptions); - const rxjsPackagePath = require.resolve('rxjs/package.json', resolveOptions); + const resolveOptions = { + basedir: projectRoot, + checkGlobal: false, + checkLocal: true, + }; + const angularPackagePath = resolve('@angular/core/package.json', resolveOptions); + const rxjsPackagePath = resolve('rxjs/package.json', resolveOptions); if (!isInside(projectRoot, angularPackagePath) || !isInside(projectRoot, rxjsPackagePath)) {