Skip to content

Commit 2fe5391

Browse files
clydinhansl
authored andcommitted
fix(@angular/cli): fully resolve rxjs & core during version checks
1 parent 664289d commit 2fe5391

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/angular/cli/upgrade/version.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
import { tags, terminal } from '@angular-devkit/core';
10+
import { resolve } from '@angular-devkit/core/node';
1011
import * as path from 'path';
1112
import { SemVer, satisfies } from 'semver';
1213
import { isWarningEnabled } from '../utilities/config';
@@ -53,9 +54,13 @@ export class Version {
5354
};
5455

5556
try {
56-
const resolveOptions = { paths: [ path.join(projectRoot, 'node_modules'), projectRoot ] };
57-
const angularPackagePath = require.resolve('@angular/core/package.json', resolveOptions);
58-
const rxjsPackagePath = require.resolve('rxjs/package.json', resolveOptions);
57+
const resolveOptions = {
58+
basedir: projectRoot,
59+
checkGlobal: false,
60+
checkLocal: true,
61+
};
62+
const angularPackagePath = resolve('@angular/core/package.json', resolveOptions);
63+
const rxjsPackagePath = resolve('rxjs/package.json', resolveOptions);
5964

6065
if (!isInside(projectRoot, angularPackagePath)
6166
|| !isInside(projectRoot, rxjsPackagePath)) {

0 commit comments

Comments
 (0)