Open ollebergkvist opened 9 months ago
I'm getting the error also after setting node-linker=hoisted in my .npmrc file
I just tried to use turborepo with yarn with this config:
yarnrc.yml
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-3.4.1.cjs
Same error.
I hit this today, I'm using pnpm@v8
in a monorepo, running node@v20.11.0
, pkg details are
"@google-cloud/recaptcha-enterprise": "5.3.0",
"next": "14.1.0"
stack:
../../node_modules/.pnpm/google-gax@4.3.1/node_modules/google-gax/build/src/streamingRetryRequest.js
Module not found: Can't resolve 'request' in '~/node_modules/.pnpm/google-gax@4.3.1/node_modules/google-gax/build/src'
Import trace for requested module:
../../node_modules/.pnpm/google-gax@4.3.1/node_modules/google-gax/build/src/streamingRetryRequest.js
../../node_modules/.pnpm/google-gax@4.3.1/node_modules/google-gax/build/src/streamingCalls/streaming.js
../../node_modules/.pnpm/google-gax@4.3.1/node_modules/google-gax/build/src/index.js
../../node_modules/.pnpm/@google-cloud+recaptcha-enterprise@5.3.0/node_modules/@google-cloud/recaptcha-enterprise/build/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.js
../../node_modules/.pnpm/@google-cloud+recaptcha-enterprise@5.3.0/node_modules/@google-cloud/recaptcha-enterprise/build/src/v1beta1/index.js
../../node_modules/.pnpm/@google-cloud+recaptcha-enterprise@5.3.0/node_modules/@google-cloud/recaptcha-enterprise/build/src/index.js
For @google-cloud/tasks it's more complicated, it just continues with more modules missing after installing request eg: "Error: Cannot find module '/app/node_modules/.pnpm/@google-cloud+tasks@5.1.1_encoding@0.1.13/node_modules/@google-cloud/tasks/build/esm/src/v2/cloud_tasks_client_config.json'"
I am running into the same issue
import trace for requested module: ../../node_modules/.pnpm/google-gax@4.3.1/node_modules/google-gax/build/src/streamingRetryRequest.js ../../node_modules/.pnpm/google-gax@4.3.1/node_modules/google-gax/build/src/streamingCalls/streaming.js ../../node_modules/.pnpm/google-gax@4.3.1/node_modules/google-gax/build/src/index.js ../../node_modules/.pnpm/@google-analytics+data@4.4.0/node_modules/@google-analytics/data/build/src/v1alpha/alpha_analytics_data_client.js ../../node_modules/.pnpm/@google-analytics+data@4.4.0/node_modules/@google-analytics/data/build/src/v1alpha/index.js ../../node_modules/.pnpm/@google-analytics+data@4.4.0/node_modules/@google-analytics/data/build/src/index.js ./src/app/api/analytics/route.ts ⚠ ../../node_modules/.pnpm/google-gax@4.3.1/node_modules/google-gax/build/src/streamingRetryRequest.js Module not found: Can't resolve 'request' in '/node_modules/.pnpm/google-gax@4.3.1/node_modules/google-gax/build/src'
I'm also running into this problem with the google tasks library for node
Error: Cannot find module 'node_modules\@google-cloud\tasks\build\esm\src\v2\cloud_tasks_client_config.json'
I do not get this error if i downgrade to version 5.0.0. but anythging beyond this version triggers the error. I'm using NextJS 14
I am also getting this issue while trying to use Document AI:
Module not found: Can't resolve 'request' in '/node_modules/.pnpm/google-gax@4.3.2/node_modules/google-gax/build/src'
Import trace for requested module:
./node_modules/.pnpm/google-gax@4.3.2/node_modules/google-gax/build/src/streamingRetryRequest.js
./node_modules/.pnpm/google-gax@4.3.2/node_modules/google-gax/build/src/streamingCalls/streaming.js
./node_modules/.pnpm/google-gax@4.3.2/node_modules/google-gax/build/src/index.js
./node_modules/.pnpm/@google-cloud+documentai@8.2.0/node_modules/@google-cloud/documentai/build/src/v1beta1/document_understanding_service_client.js
./node_modules/.pnpm/@google-cloud+documentai@8.2.0/node_modules/@google-cloud/documentai/build/src/v1beta1/index.js
./node_modules/.pnpm/@google-cloud+documentai@8.2.0/node_modules/@google-cloud/documentai/build/src/index.js
./src/
@sofisl Hi! Hope you're well. Is there an ETA for when we might see a fix here? Many thanks in advance 🙏
Has anyone tried just installing request? E.g. "pnpm add request"? It worked for me, although request is a long deprecated module.
Has anyone tried just installing request? E.g. "pnpm add request"? It worked for me, although request is a long deprecated module.
Yepp, the missing modules stack continues... at least for @google-cloud/tasks but I guess for some of the libs that might be a sufficient fix.
Sorry for the delay, I will take a look next week.
Ok after looking into this, there are two separate issues happening:
pnpm
because there are some discrepancies in how it installs modules (for example, not implicitly installing the highest version of a dependency with a caret). That being said, we actually use pnpm to install dependencies during tests, so this seemed a little weird to me. Since tests haven't failed, I attempted to reproduce with Node 18 and pnpm 8.6.10 locally, and was able to run our sample test successfully (after fixing some issues with the module resolution as described here). Are any of these issues occuring in just a Nodejs environment (without Vercel or Next.js?)@sofisl I have this issue too - it doesn't cause any runtime issues but it clutters up my console with a lot of distracting warnings. Can you describe your module resolution workaround so I can try that?
I'm using @google-cloud/documentai ^8.8.0 and this is the runtime warning:
@kofron can you elaborate on your environment? Are you using Next.js?
I think this is a bundling issue with next.js. This seems related, could you try installing request as well. It seems Next.js doesn't bundle this dependency for some reason.
I'm getting this error during build time using @google-cloud/tasks in a turborepo(monorepo).
It seems to be directly related to pnpm, I'm using @google-cloud/tasks in another Vercel project which uses yarn, and the error is not triggered during build in this case.
Is pnpm supported?
Environment details
System: OS: macOS 12.7.2 CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz Memory: 1.29 GB / 32.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.18.2 - ~/.asdf/installs/nodejs/lts/bin/node npm: 9.8.1 - ~/.asdf/plugins/nodejs/shims/npm pnpm: 8.11.0 - ~/.asdf/installs/nodejs/lts/bin/pnpm Browsers: Chrome: 120.0.6099.234 Safari: 17.2.1 npmPackages: @google-cloud/tasks: ^4.0.1 => 4.0.1
Steps to reproduce
Please include any and all code and/or steps related to reproducing the bug.
Making sure to follow these steps will guarantee the quickest resolution possible.
Thanks!