1

I switched to pnpm in most of the apps that I maintain and it's an amazing tool. What I don't understand is how to troubleshoot dependency issues. I would really appreciate some help.

The problem comes from one ember-specific addon, and I opened a new issue in their repo, but I'd like to be able to figure out what to do in case issues like that happen with dependencies in general.


The error is Cannot find module ..., if you add the missing module there's another "missing" one and another one and another one ...

❯ ember s
Building into /private/var/folders/k0/b1p9d5g94px8gdr10458gv0m0000gn/T/embroider/96cc9c
Build Error (broccoli-persistent-filter:Babel > [Babel: ember-table]) in ember-table/ember-table/-private/collapse-tree.js

Cannot find module '@babel/plugin-proposal-object-rest-spread'
Require stack:
- /app-root/node_modules/.pnpm/@babel+core@7.18.13/node_modules/@babel/core/lib/config/files/plugins.js
- /app-root/node_modules/.pnpm/@babel+core@7.18.13/node_modules/@babel/core/lib/config/files/index.js
- /app-root/node_modules/.pnpm/@babel+core@7.18.13/node_modules/@babel/core/lib/index.js
- /app-root/node_modules/.pnpm/broccoli-babel-transpiler@7.8.1/node_modules/broccoli-babel-transpiler/lib/worker.jsError: Cannot find module '@babel/plugin-proposal-object-rest-spread'
Require stack:
- /app-root/node_modules/.pnpm/@babel+core@7.18.13/node_modules/@babel/core/lib/config/files/plugins.js
- /app-root/node_modules/.pnpm/@babel+core@7.18.13/node_modules/@babel/core/lib/config/files/index.js
- /app-root/node_modules/.pnpm/@babel+core@7.18.13/node_modules/@babel/core/lib/index.js
- /app-root/node_modules/.pnpm/broccoli-babel-transpiler@7.8.1/node_modules/broccoli-babel-transpiler/lib/worker.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at resolve (internal/modules/cjs/helpers.js:107:19)
    at tryRequireResolve (/app-root/node_modules/.pnpm/@babel+core@7.18.13/node_modules/@babel/core/lib/config/files/plugins.js:157:9)
    at resolveStandardizedNameForRequire (/app-root/node_modules/.pnpm/@babel+core@7.18.13/node_modules/@babel/core/lib/config/files/plugins.js:195:19)
    at sync (/app-root/node_modules/.pnpm/@babel+core@7.18.13/node_modules/@babel/core/lib/config/files/plugins.js:224:12)
    at sync (/app-root/node_modules/.pnpm/gensync@1.0.0-beta.2/node_modules/gensync/index.js:182:19)
    at /app-root/node_modules/.pnpm/gensync@1.0.0-beta.2/node_modules/gensync/index.js:210:24
    at Generator.next (<anonymous>)
    at resolvePlugin (/app-root/node_modules/.pnpm/@babel+core@7.18.13/node_modules/@babel/core/lib/config/files/plugins.js:83:17)
    at resolvePlugin.next (<anonymous>)


Stack Trace and Error Report: /var/folders/k0/b1p9d5g94px8gdr10458gv0m0000gn/T/error.dump.8c92aeb46d1be7e57b69153a731964ac.log

Steps to reproduce

  1. ember init -sn -sb -sg --no-welcome --embroider
  2. pnpm install
  3. Confirm no build error ember s
  4. ember install ember-table
  5. See the build error ember s

Environment

❯ ember --version && pnpm --version && node --version
ember-cli: 4.6.0
node: 14.19.1
os: darwin x64
7.9.4
v14.19.1
rreckonerr
  • 33
  • 5
  • does this happen with just pnpm, or other package managers, too? – NullVoxPopuli Sep 07 '22 at 18:26
  • does the problem go away if you add `@babel/plugin-proposal-object-rest-spread` to your dependencies? it may be worth opening an issue on ember-table's repo to remove that package, as all browsers support rest spread now. – NullVoxPopuli Sep 07 '22 at 18:27
  • The problem goes away when I switch to yarn. When I add `@babel/plugin-proposal-object-rest-spread` to the deps I get error message related to another babel dependency. I gave up after adding ~15 deps. I think the full list is coming from ember-cli-page-object-deps – rreckonerr Sep 08 '22 at 14:08
  • The list is too long https://cdn.discordapp.com/attachments/483601670685720591/1011932991586582628/ember-cli-page-object-missing-peer-deps.txt And I don't remember exactly how I got this list unfortunately – rreckonerr Sep 08 '22 at 14:09
  • 1
    it sounds like your dependencies are doing something nasty if switching to yarn (objectively terrible with deps / peers) fixes things. can you report this issue to ember-table? it wouldn't be the first time they're doing bad stuff with deps – NullVoxPopuli Sep 08 '22 at 14:45
  • Thanks! Yeah, that’s exactly what I did, there’s a link to the open issue in description. I just don’t like feeling helpless here I just hoped there’s a way to tell pnpm to treat ember-table in a *special* way and hoist all of the ember-table deps – rreckonerr Sep 08 '22 at 18:44
  • there is actually! tho, not all sub-deps, but you can manually specify certain ones: https://pnpm.io/npmrc#public-hoist-pattern – NullVoxPopuli Sep 08 '22 at 21:38
  • Yeah, I tried it out already. ``` // .npmrc public-hoist-pattern[]=*eslint* public-hoist-pattern[]=*prettier* public-hoist-pattern[]=*ember-table* ``` – rreckonerr Sep 09 '22 at 13:12
  • 1
    did you try adding `@babel/*` as well? – NullVoxPopuli Sep 09 '22 at 17:29
  • Woohoo! Adding `@babel/*` to the public host pattern works perfectly! ` public-hoist-pattern[]=*eslint* public-hoist-pattern[]=*prettier* public-hoist-pattern[]=@babel/* ` eslint and prettier are the default values – rreckonerr Sep 13 '22 at 09:05

0 Answers0