hey! I’m trying the inline automation api and gett...
# general
a
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
What does your package.json look like? And what does your resolutions section look like?
a
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
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
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
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
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
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