Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module '.pnpm/package.json' when running ember-mapbox-gl with pnpm #122

Open
johanrd opened this issue Aug 15, 2022 · 2 comments

Comments

@johanrd
Copy link
Contributor

johanrd commented Aug 15, 2022

  1. Clone https://github.com/johanrd/ember-mabox-gl-pnpm-repro or create a fresh ember app with pnpm:
ember new ember-mabox-gl-pnpm-repro --skip-npm
cd ember-mabox-gl-pnpm-repro
pnpm install
pnpm add ember-mapbox-gl mapbox-gl
  1. Run pnpm start and experience the following error:
Cannot find module '.pnpm/package.json' from '/Users/me/ember-mabox-gl-pnpm-repro'

=================================================================================

ENV Summary:

  TIME: Mon Aug 15 2022 20:54:33 GMT+0200 (Central European Summer Time)
  TITLE: ember
  ARGV:
  - /usr/local/Cellar/node@16/16.16.0/bin/node
  - /usr/local/bin/ember
  - serve
  - --proxy
  - http://localhost:5000
  EXEC_PATH: /usr/local/Cellar/node@16/16.16.0/bin/node
  TMPDIR: /var/folders/d6/mxwlnyds65dgg3pkb8kzgxzw0000gn/T
  SHELL: /bin/zsh
  PATH:
  - /Users/me/ember-mabox-gl-pnpm-repro
  - /usr/bin
  - /bin
  - /usr/sbin
  - /sbin
  - /Library/TeX/texbin
  - /Library/Apple/usr/bin
  PLATFORM: darwin x64
  FREEMEM: 573804544
  TOTALMEM: 34359738368
  UPTIME: 1375982
  LOADAVG: 3.62255859375,3.98779296875,4.1123046875
  ENDIANNESS: LE
  VERSIONS:
  - ares: 1.18.1
  - brotli: 1.0.9
  - cldr: 40.0
  - icu: 70.1
  - llhttp: 6.0.7
  - modules: 93
  - napi: 8
  - nghttp2: 1.48.0
  - node: 16.16.0
  - openssl: 1.1.1q
  - tz: 2021a3
  - unicode: 14.0
  - uv: 1.44.1
  - v8: 9.4.146.24-node.21
  - zlib: 1.2.11

ERROR Summary:

  - broccoliBuilderErrorStack: [undefined]
  - code: MODULE_NOT_FOUND
  - codeFrame: [undefined]
  - errorMessage: Cannot find module '.pnpm/package.json' from '/Users/me/ember-mabox-gl-pnpm-repro'
  - errorType: [undefined]
  - location:
    - column: [undefined]
    - file: [undefined]
    - line: [undefined]
  - message: Cannot find module '.pnpm/package.json' from '/Users/me/ember-mabox-gl-pnpm-repro'
  - name: Error
  - nodeAnnotation: [undefined]
  - nodeName: [undefined]
  - originalErrorMessage: [undefined]
  - stack: Error: Cannot find module '.pnpm/package.json' from '/Users/me/ember-mabox-gl-pnpm-repro'
    at Function.resolveSync [as sync] (/Users/me/ember-mabox-gl-pnpm-repro/node_modules/.pnpm/resolve@1.22.1/node_modules/resolve/lib/sync.js:111:15)
    at EmberApp.import (/Users/me/ember-mabox-gl-pnpm-repro/node_modules/.pnpm/ember-cli@4.6.0_lodash@4.17.21/node_modules/ember-cli/lib/broccoli/ember-app.js:1477:40)
    at Class.included (/Users/me/ember-mabox-gl-pnpm-repro/node_modules/.pnpm/ember-mapbox-gl@2.0.0_ckc3ivbmq2acquefckrorczpfu/node_modules/ember-mapbox-gl/index.js:28:15)
    at Class.superWrapper [as included] (/Users/me/ember-mabox-gl-pnpm-repro/node_modules/.pnpm/core-object@3.1.5/node_modules/core-object/lib/assign-properties.js:34:20)
    at /Users/me/ember-mabox-gl-pnpm-repro/node_modules/.pnpm/ember-cli@4.6.0_lodash@4.17.21/node_modules/ember-cli/lib/broccoli/ember-app.js:721:15
    at Array.forEach (<anonymous>)
    at EmberApp._notifyAddonIncluded (/Users/me/ember-mabox-gl-pnpm-repro/node_modules/.pnpm/ember-cli@4.6.0_lodash@4.17.21/node_modules/ember-cli/lib/broccoli/ember-app.js:719:25)
    at new EmberApp (/Users/me/ember-mabox-gl-pnpm-repro/node_modules/.pnpm/ember-cli@4.6.0_lodash@4.17.21/node_modules/ember-cli/lib/broccoli/ember-app.js:135:10)
    at module.exports (/Users/me/ember-mabox-gl-pnpm-repro/ember-cli-build.js:13:13)
    at Builder.readBuildFile (/Users/me/ember-mabox-gl-pnpm-repro/node_modules/.pnpm/ember-cli@4.6.0_lodash@4.17.21/node_modules/ember-cli/lib/models/builder.js:49:14)
    at Builder.setupBroccoliBuilder (/Users/me/ember-mabox-gl-pnpm-repro/node_modules/.pnpm/ember-cli@4.6.0_lodash@4.17.21/node_modules/ember-cli/lib/models/builder.js:63:22)
    at new Builder (/Users/me/ember-mabox-gl-pnpm-repro/node_modules/.pnpm/ember-cli@4.6.0_lodash@4.17.21/node_modules/ember-cli/lib/models/builder.js:29:10)
    at ServeTask.run (/Users/me/ember-mabox-gl-pnpm-repro/node_modules/.pnpm/ember-cli@4.6.0_lodash@4.17.21/node_modules/ember-cli/lib/tasks/serve.js:49:7)
    at /Users/me/ember-mabox-gl-pnpm-repro/node_modules/.pnpm/ember-cli@4.6.0_lodash@4.17.21/node_modules/ember-cli/lib/models/command.js:238:24
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Class.run (/Users/me/ember-mabox-gl-pnpm-repro/node_modules/.pnpm/ember-cli@4.6.0_lodash@4.17.21/node_modules/ember-cli/lib/commands/serve.js:106:5)

=================================================================================

Possibly related to dynamic imports?

@kturney
Copy link
Owner

kturney commented Aug 22, 2022

Hi @johanrd, thanks for the issue.

I've never used pnpm myself.

Does it seem at all related to embroider-build/ember-auto-import#353?

@johanrd
Copy link
Contributor Author

johanrd commented Apr 17, 2023

@kturney FYI: referring to this comment, the error for pnpm (and probably other modern package managers like yarn 3) was in this line: https://github.com/kturney/ember-mapbox-gl/blob/master/index.js#L21, where mapbox-gl/package.json was accessed relative to the context of ember-cli instead of ember-mapbox-gl.

I tried to remove the whole included function, and can verify that ember-mapbox-gl is no longer blocking build through pnpm. (syles needed to be imported otherwise through e.g. @import "mapbox-gl/dist/mapbox-gl.css", though)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants