https://pulumi.com logo
a

able-pager-97491

07/29/2021, 9:41 PM
hey! I’m trying the inline automation api and getting the error added by https://github.com/pulumi/pulumi/pull/7349
Copy code
error: Unhandled exception: Error: Detected multiple versions of '@pulumi/pulumi' in use in an inline automation api program.
    Use the yarn 'resolutions' field to pin to a single version: <https://github.com/pulumi/pulumi/issues/5449>.
I tried the resolutions field with no luck so far
pulumi version v3.9.0
r

red-match-15116

07/30/2021, 12:55 AM
What does your package.json look like? And what does your resolutions section look like?
a

able-pager-97491

07/30/2021, 2:23 PM
Copy code
"dependencies": {
    "@pulumi/pulumi": "3.8.0",
    "@pulumi/kubernetes": "3.4.0",
    "ts-node": "^9.0.0"
  },
  "resolutions": {
    "@pulumi/pulumi": "3.8.0",
    "@pulumi/kubernetes": "3.4.0"
  },
(just changed to 3.8.0 to test, but I got the error with 3.9.0 as well)
r

red-match-15116

07/30/2021, 4:19 PM
It doesn’t look like your resolutions section is correct. See this reference for how you would need to formulate the resolutions: https://classic.yarnpkg.com/en/docs/selective-version-resolutions/#toc-how-to-use-it
l

lemon-agent-27707

07/30/2021, 5:36 PM
I think what you'll want is:
Copy code
"dependencies": {
    "@pulumi/pulumi": "3.8.0",
    "@pulumi/kubernetes": "3.4.0",
    "ts-node": "^9.0.0"
  },
  "resolutions": {
    "@pulumi/pulumi": "3.8.0",
  },
Then
rm -rf node_modules
and
yarn install
a

able-pager-97491

07/30/2021, 6:41 PM
I can’t find the difference between my version and yours 🤔
But I think I figured out what happened: I was testing locally using yarn link, so there were two node_modules inside the tree. The pulumi library was being loaded twice, and even though it was the same version, the check code caught it.
r

red-match-15116

07/30/2021, 6:43 PM
Your version:
Copy code
"resolutions": {
    "@pulumi/pulumi": "3.8.0",
    "@pulumi/kubernetes": "3.4.0"
  },
Evan’s version:
Copy code
"resolutions": {
    "@pulumi/pulumi": "3.8.0",
  },
But anyway, glad you got it working.
a

able-pager-97491

07/30/2021, 6:44 PM
the extra kubernetes? that doesn’t make any difference, but I tested without it as well :)
for future reference, this is a simplified version of what I’m trying to do: https://github.com/cangussu/pulumi-resource-generator https://github.com/cangussu/pulumi-automation
and thanks for taking a look at this!
👍🏽 1
1
19 Views