pulumi: Error: package.json export path for ".pnpm/tslib@2.4.0/node_modules/tslib/tslib.js" not found

What happened?

After upgrade we are not able to run pulumi up successfully

Diagnostics:
  pulumi:pulumi:Stack (app-web-app-web.dev):
    error: Error: package.json export path for ".pnpm/tslib@2.4.0/node_modules/tslib/tslib.js" not found
        at ModuleMap.get (/home/nemesis/workspace/nxapp/node_modules/.pnpm/@pulumi+pulumi@3.35.2/node_modules/@pulumi/runtime/closure/package.ts:214:19)
        at Object.getModuleFromPath (/home/nemesis/workspace/nxapp/node_modules/.pnpm/@pulumi+pulumi@3.35.2/node_modules/@pulumi/runtime/closure/package.ts:263:35)
        at /home/nemesis/workspace/nxapp/node_modules/.pnpm/@pulumi+pulumi@3.35.2/node_modules/@pulumi/runtime/closure/createClosure.ts:1229:19
        at Generator.next (<anonymous>)
        at /home/nemesis/workspace/nxapp/node_modules/.pnpm/@pulumi+pulumi@3.35.2/node_modules/@pulumi/pulumi/runtime/closure/createClosure.js:21:71
        at new Promise (<anonymous>)
        at __awaiter (/home/nemesis/workspace/nxapp/node_modules/.pnpm/@pulumi+pulumi@3.35.2/node_modules/@pulumi/pulumi/runtime/closure/createClosure.js:17:12)
        at captureModuleAsync (/home/nemesis/workspace/nxapp/node_modules/.pnpm/@pulumi+pulumi@3.35.2/node_modules/@pulumi/pulumi/runtime/closure/createClosure.js:871:20)
        at /home/nemesis/workspace/nxapp/node_modules/.pnpm/@pulumi+pulumi@3.35.2/node_modules/@pulumi/runtime/closure/createClosure.ts:931:19
        at Generator.next (<anonymous>)
 
    (node:1359) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 2)
    (Use `node --trace-warnings ...` to show where the warning was created)
 
 

Steps to reproduce

"@pulumi/pulumi": "~3.35.2",

pulumi up

Expected Behavior

It’s working when downgrading on this version

"@pulumi/pulumi": "~3.24.1",

Actual Behavior

It fails after upgrading pulumi version

Versions used

CLI
Version 3.35.2 Go Version go1.17.11 Go Compiler gc

Host
OS ubuntu Version 20.04 Arch x86_64

Additional context

It seems related to #8893 @dixler this could be of interest

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you’ve opened one already).

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 2
  • Comments: 21 (8 by maintainers)

Most upvoted comments

@dixler good news we solved most of the issues of node_modules deps

following node-linker=hoisted

in .npmrc

node-linker=hoisted

using pnpm in hoisted mode makes it compatible with pulumi as of now

hoisted - a flat node_modules without symlinks is created. Same as the node_modules created by npm or Yarn Classic. Legitimate reasons to use this setting:
Your tooling doesn't work well with symlinks. A React Native project will most probably only work if you use a hoisted node_modules.
Your project is deployed to a serverless hosting provider. Some serverless providers (for instance, AWS Lambda) don't support symlinks. An alternative solution for this problem is to bundle your application before deployment.

we still have the issue of locating the right package.json in the root of our monorepo, still using the bypass that we described previously

Also we pushed a Lambda to AWS with this fixes, the Lambda is sent to AWS successfully but when it runs in the cloud it fails, it seems like something is not loaded right.

Here is the log, could be related

{
    "errorType": "Error",
    "errorMessage": "Cannot find module '.pnpm/tslib@2.4.0/node_modules/tslib/tslib.js'\nRequire stack:\n- /var/task/__index.js\n- /var/runtime/UserFunction.js\n- /var/runtime/Runtime.js\n- /var/runtime/index.js",
    "code": "MODULE_NOT_FOUND",
    "requireStack": [
        "/var/task/__index.js",
        "/var/runtime/UserFunction.js",
        "/var/runtime/Runtime.js",
        "/var/runtime/index.js"
    ],
    "stack": [
        "Error: Cannot find module '.pnpm/tslib@2.4.0/node_modules/tslib/tslib.js'",
        "Require stack:",
        "- /var/task/__index.js",
        "- /var/runtime/UserFunction.js",
        "- /var/runtime/Runtime.js",
        "- /var/runtime/index.js",
        "    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:746:27)",
        "    at Module.require (internal/modules/cjs/loader.js:974:19)",
        "    at require (internal/modules/cjs/helpers.js:101:18)",
        "    at /var/task/__index.js:5:21",
        "    at Runtime.__f0 [as handler] (/var/task/__index.js:20:6)",
        "    at Runtime.handleOnceNonStreaming (/var/runtime/Runtime.js:73:25)"
    ]
}