Skip to content

Commit

Permalink
solution to cli issue TypeError: Cannot read properties of undefined …
Browse files Browse the repository at this point in the history
…(reading 'fsPath') #895
  • Loading branch information
gauravsaini04 committed Oct 28, 2024
1 parent 9ba1fda commit 925a1eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/spec-configuration/lockfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export async function writeLockfile(params: ContainerFeatureInternalParams, conf
return;
}

export async function readLockfile(config: DevContainerConfig): Promise<{ lockfile?: Lockfile; initLockfile?: boolean }> {
export async function readLockfile(config: DevContainerConfig | string): Promise<{ lockfile?: Lockfile; initLockfile?: boolean }> {
try {
const content = await readLocalFile(getLockfilePath(config));
// If empty file, use as marker to initialize lockfile when build completes.
Expand Down
4 changes: 3 additions & 1 deletion src/spec-node/featuresCLI/resolveDependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ async function featuresResolveDependencies({
env: process.env,
};

const { lockfile } = await readLockfile(config);
let configObj: DevContainerConfig | string = config.hasOwnProperty('configFilePath') && config.configFilePath ? config : configPath;

const { lockfile } = await readLockfile(configObj);
const processFeature = async (_userFeature: DevContainerFeature) => {
return await processFeatureIdentifier(params, configPath, workspaceFolder, _userFeature, lockfile);
};
Expand Down

0 comments on commit 925a1eb

Please sign in to comment.