Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import {
WorkspaceNodeModulesArchitectHost,
} from '@angular-devkit/architect/node';
import { json } from '@angular-devkit/core';
import { existsSync } from 'node:fs';
import { resolve } from 'node:path';
import { createRequire } from 'node:module';
import { isPackageNameSafeForAnalytics } from '../analytics/analytics';
import { EventCustomDimension, EventCustomMetric } from '../analytics/analytics-parameters';
import { assertIsError } from '../utilities/error';
Expand Down Expand Up @@ -210,15 +209,13 @@ export abstract class ArchitectBaseCommandModule<T extends object>
return;
}

// Check if yarn PnP is used. https://yarnpkg.com/advanced/pnpapi#processversionspnp
if (process.versions.pnp) {
return;
}
const workspaceResolve = createRequire(basePath + '/').resolve;

try {
workspaceResolve('@angular/core');

// Check for a `node_modules` directory (npm, yarn non-PnP, etc.)
if (existsSync(resolve(basePath, 'node_modules'))) {
return;
}
} catch {}

this.context.logger.warn(
`Node packages may not be installed. Try installing with '${this.context.packageManager.name} install'.`,
Expand Down