diff --git a/workspaces/arborist/lib/arborist/reify.js b/workspaces/arborist/lib/arborist/reify.js index 3c01113b7a6f3..6f1d8c84ea884 100644 --- a/workspaces/arborist/lib/arborist/reify.js +++ b/workspaces/arborist/lib/arborist/reify.js @@ -12,8 +12,8 @@ const hgi = require('hosted-git-info') const rpj = require('read-package-json-fast') const { dirname, resolve, relative, join } = require('node:path') -const { existsSync } = require("node:fs") const { depth: dfwalk } = require('treeverse') +const { existsSync } = require('node:fs') const { lstat, mkdir, @@ -124,9 +124,11 @@ module.exports = cls => class Reifier extends cls { // we do NOT want to set ownership on this folder, especially // recursively, because it can have other side effects to do that // in a project directory. We just want to make it if it's missing. - let resolvedPath = resolve(this.path); - if(!existsSync(resolvedPath)) + const resolvedPath = resolve(this.path) + if (!existsSync(resolvedPath)) + { await mkdir(resolvedPath, { recursive: true }) + } // do not allow the top-level node_modules to be a symlink await this.#validateNodeModules(resolve(resolvedPath, 'node_modules'))