cold-coat-35200
11/30/2018, 5:19 PM├── bastion // pulumi project
├── dliver //pulumi project
├── modules // shared custom modules
├── node_modules // shared node_modules
└── static
bastion/dliver has it's own package.json and pulumi related files, but their node_modules directory is empty, they only using the shared node_modules.
It work fine, until I'm trying to use a custom dynamic provider, in that case I got this error during the preview:
Diagnostics:
pulumi:providers:pulumi-nodejs (default):
error: could not read plugin [/home/ncsibra/.pulumi/bin/pulumi-resource-pulumi-nodejs] stdout: EOF
pulumi:pulumi:Stack (bastion-bastion-dev):
(node:2514) ExperimentalWarning: queueMicrotask() is experimental.
internal/modules/cjs/loader.js:589
throw err;
^
Error: Cannot find module '/home/ncsibra/dev/prmrgt-infra/pulumi/bastion/node_modules/@pulumi/pulumi/cmd/dynamic-provider'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:587:15)
at Function.Module._load (internal/modules/cjs/loader.js:513:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:760:12)
at startup (internal/bootstrap/node.js:303:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:872:3)
The module is in the /home/ncsibra/dev/prmrgt-infra/pulumi/node_modules/@pulumi/pulumi/cmd/dynamic-provider
directory, not in the /home/ncsibra/dev/prmrgt-infra/pulumi/bastion/node_modules/@pulumi/pulumi/cmd/dynamic-provider
.
Without the dynamic provider, the preview runs fine.
I think the problem is not the dynamic provider, because with the old structure(it was one pulumi project, which contained the modules and the node_modules directory too with 1 package.json) everything worked fine.
Any idea why it's not find the @pulumi/pulumi/cmd/dynamic-provider
module, but find everything else in @pulumi/pulumi
and @pulumi/aws
?bitter-oil-46081
11/30/2018, 7:04 PM~/.pulumi/bin/pulumi-resource-pulumi-nodejs
to look like this:
#!/bin/sh
node $(node -e "console.log(require.resolve('@pulumi/pulumi/cmd/dynamic-provider'))") $@
The change here is that instead of the relative path, we now use $(node -e "console.log(require.resolve('@pulumi/pulumi/cmd/dynamic-provider'))")
to construct the path where the dymanic provider's launcher is, which will allow node to use its normal resolution semantics.
I believe that will address your issue, based on my local testing it does for me.cold-coat-35200
11/30/2018, 8:15 PMbitter-oil-46081
12/01/2018, 1:43 AMcold-coat-35200
12/01/2018, 4:14 PMbitter-oil-46081
12/01/2018, 6:59 PMcold-coat-35200
12/07/2018, 5:56 AM