diff --git a/packages/jsii-pacmak/lib/packaging.ts b/packages/jsii-pacmak/lib/packaging.ts index 162ba2c03c..31ceed9c18 100644 --- a/packages/jsii-pacmak/lib/packaging.ts +++ b/packages/jsii-pacmak/lib/packaging.ts @@ -55,7 +55,9 @@ export class JsiiModule { public async npmPack() { this._tarball = await Scratch.make(async (tmpdir) => { logging.debug(`Running "npm pack ${this.moduleDirectory}" in ${tmpdir}`); - const args = ['pack', this.moduleDirectory]; + // Quoting (JSON-stringifying) the module directory in order to avoid + // problems if there are spaces or other special characters in the path. + const args = ['pack', JSON.stringify(this.moduleDirectory)]; if (logging.level >= logging.LEVEL_VERBOSE) { args.push('--loglevel=verbose'); }