question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect monorepo package resolution? @glimmer/syntax -> @glimmer/util, but in ember-source, except not found

See original GitHub issue

ref: https://github.com/glimmerjs/glimmer.js/issues/345

Reason why I’m thinking this might be a dependency resolution issue, In this PR where renovate upgrades my app from 3.26.x to 3.27.x I get the error

Build Error (PackagerRunner) in ../../../../home/me/Development/NullVoxPopuli/limber/frontend/node_modules/@glimmer/syntax/dist/modules/es2017/lib/parser.js

Module not found: Error: Can't resolve 'ember-source/@glimmer/util.js' in '/home/me/Development/NullVoxPopuli/limber/frontend/node_modules/@glimmer/syntax/dist/modules/es2017/lib/parser.js'
Log
=================================================================================

ENV Summary:

  TIME: Thu May 20 2021 07:39:40 GMT-0400 (Eastern Daylight Time)
  TITLE: ember
  ARGV:
  - /home/me/.volta/tools/image/node/14.17.0/bin/node
  - /home/me/Development/NullVoxPopuli/limber/frontend/node_modules/.bin/ember
  - serve
  EXEC_PATH: /home/me/.volta/tools/image/node/14.17.0/bin/node
  TMPDIR: /tmp
  SHELL: /bin/bash
  PATH:
  - /tmp/yarn--1621510740646-0.05927598237875187
  - /home/me/Development/NullVoxPopuli/limber/frontend/node_modules/.bin
  - /home/me/.config/yarn/link/node_modules/.bin
  - /home/me/Development/NullVoxPopuli/limber/node_modules/.bin
  - /home/me/.volta/tools/image/node/14.17.0/libexec/lib/node_modules/npm/bin/node-gyp-bin
  - /home/me/.volta/tools/image/node/14.17.0/lib/node_modules/npm/bin/node-gyp-bin
  - /home/me/.volta/tools/image/node/14.17.0/bin/node_modules/npm/bin/node-gyp-bin
  - /tmp/yarn--1621510740233-0.7965985169595542
  - /home/me/Development/NullVoxPopuli/limber/node_modules/.bin
  - /home/me/.config/yarn/link/node_modules/.bin
  - /home/me/Development/NullVoxPopuli/limber/node_modules/.bin
  - /home/me/.yarn/bin
  - /home/me/.volta/tools/image/node/14.17.0/libexec/lib/node_modules/npm/bin/node-gyp-bin
  - /home/me/.volta/tools/image/node/14.17.0/lib/node_modules/npm/bin/node-gyp-bin
  - /home/me/.volta/tools/image/node/14.17.0/bin/node_modules/npm/bin/node-gyp-bin
  - /home/me/.volta/tools/image/npm/7.11.1/bin
  - /home/me/.volta/tools/image/yarn/1.22.10/bin
  - /home/me/.volta/tools/image/node/14.17.0/bin
  - /home/me/.volta/bin
  - /home/me/.pythons/Python-3.6.3/bin
  - /home/me/.cargo/bin
  - /home/me/Applications
  - /home/me/apps/phantomjs/bin
  - /home/me/scripts/system-utils
  - /home/me/scripts/git
  - /home/me/scripts/rails
  - /home/me/scripts
  - /home/me/.volta/bin
  - /usr/local/sbin
  - /usr/local/bin
  - /usr/sbin
  - /usr/bin
  - /sbin
  - /bin
  - /usr/games
  - /usr/local/games
  - /snap/bin
  - /home/me/.dotnet/tools
  - /home/me/.dotnet/tools
  - /home/me/.fzf/bin
  PLATFORM: linux x64
  FREEMEM: 277475328
  TOTALMEM: 17388204032
  UPTIME: 421813.43
  LOADAVG: 2.24,0.84,0.35
  CPUS:
  - Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz - 3192
  - Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz - 3192
  - Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz - 3192
  - Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz - 3192
  - Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz - 3192
  - Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz - 3192
  ENDIANNESS: LE
  VERSIONS:
  - ares: 1.17.1
  - brotli: 1.0.9
  - cldr: 38.1
  - icu: 68.2
  - llhttp: 2.1.3
  - modules: 83
  - napi: 8
  - nghttp2: 1.42.0
  - node: 14.17.0
  - openssl: 1.1.1k
  - tz: 2020d
  - unicode: 13.0
  - uv: 1.41.0
  - v8: 8.4.371.23-node.63
  - zlib: 1.2.11

ERROR Summary:

  - broccoliBuilderErrorStack: ModuleNotFoundError: Module not found: Error: Can't resolve 'ember-source/@glimmer/util.js' in '/home/me/Development/NullVoxPopuli/limber/frontend/node_modules/@glimmer/syntax/dist/modules/es2017/lib'
    at /home/me/Development/NullVoxPopuli/limber/node_modules/webpack/lib/Compilation.js:1762:28
    at /home/me/Development/NullVoxPopuli/limber/node_modules/webpack/lib/NormalModuleFactory.js:730:13
    at eval (eval at create (/home/me/Development/NullVoxPopuli/limber/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
    at /home/me/Development/NullVoxPopuli/limber/node_modules/webpack/lib/NormalModuleFactory.js:273:22
    at eval (eval at create (/home/me/Development/NullVoxPopuli/limber/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at /home/me/Development/NullVoxPopuli/limber/node_modules/webpack/lib/NormalModuleFactory.js:402:22
    at /home/me/Development/NullVoxPopuli/limber/node_modules/webpack/lib/NormalModuleFactory.js:117:11
    at /home/me/Development/NullVoxPopuli/limber/node_modules/webpack/lib/NormalModuleFactory.js:646:24
    at /home/me/Development/NullVoxPopuli/limber/node_modules/webpack/lib/NormalModuleFactory.js:800:8
    at /home/me/Development/NullVoxPopuli/limber/node_modules/webpack/lib/NormalModuleFactory.js:920:5
  - code: [undefined]
  - codeFrame: Module not found: Error: Can't resolve 'ember-source/@glimmer/util.js' in '/home/me/Development/NullVoxPopuli/limber/frontend/node_modules/@glimmer/syntax/dist/modules/es2017/lib/parser.js'
  - errorMessage: ../../../../home/me/Development/NullVoxPopuli/limber/frontend/node_modules/@glimmer/syntax/dist/modules/es2017/lib/parser.js: Module not found: Error: Can't resolve 'ember-source/@glimmer/util.js' in '/home/me/Development/NullVoxPopuli/limber/frontend/node_modules/@glimmer/syntax/dist/modules/es2017/lib/parser.js'
        at PackagerRunner (@embroider/webpack)
  - errorType: Build Error
  - location:
    - column: [undefined]
    - file: ../../../../home/me/Development/NullVoxPopuli/limber/frontend/node_modules/@glimmer/syntax/dist/modules/es2017/lib/parser.js
    - line: [null]
    - treeDir: [undefined]
  - message: ../../../../home/me/Development/NullVoxPopuli/limber/frontend/node_modules/@glimmer/syntax/dist/modules/es2017/lib/parser.js: Module not found: Error: Can't resolve 'ember-source/@glimmer/util.js' in '/home/me/Development/NullVoxPopuli/limber/frontend/node_modules/@glimmer/syntax/dist/modules/es2017/lib/parser.js'
        at PackagerRunner (@embroider/webpack)
  - name: Error
  - nodeAnnotation: @embroider/webpack
  - nodeName: PackagerRunner
  - originalErrorMessage: Module not found: Error: Can't resolve 'ember-source/@glimmer/util.js' in '/home/me/Development/NullVoxPopuli/limber/frontend/node_modules/@glimmer/syntax/dist/modules/es2017/lib/parser.js'
  - stack: ModuleNotFoundError: Module not found: Error: Can't resolve 'ember-source/@glimmer/util.js' in '/home/me/Development/NullVoxPopuli/limber/frontend/node_modules/@glimmer/syntax/dist/modules/es2017/lib'
    at /home/me/Development/NullVoxPopuli/limber/node_modules/webpack/lib/Compilation.js:1762:28
    at /home/me/Development/NullVoxPopuli/limber/node_modules/webpack/lib/NormalModuleFactory.js:730:13
    at eval (eval at create (/home/me/Development/NullVoxPopuli/limber/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
    at /home/me/Development/NullVoxPopuli/limber/node_modules/webpack/lib/NormalModuleFactory.js:273:22
    at eval (eval at create (/home/me/Development/NullVoxPopuli/limber/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at /home/me/Development/NullVoxPopuli/limber/node_modules/webpack/lib/NormalModuleFactory.js:402:22
    at /home/me/Development/NullVoxPopuli/limber/node_modules/webpack/lib/NormalModuleFactory.js:117:11
    at /home/me/Development/NullVoxPopuli/limber/node_modules/webpack/lib/NormalModuleFactory.js:646:24
    at /home/me/Development/NullVoxPopuli/limber/node_modules/webpack/lib/NormalModuleFactory.js:800:8
    at /home/me/Development/NullVoxPopuli/limber/node_modules/webpack/lib/NormalModuleFactory.js:920:5

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

And here is where I think it might be a resolution problem, ember-source is in my monorepo-root node_modules (with @glimmer/util.js):

❯ ls node_modules/ember-source/dist/dependencies/@glimmer/
destroyable.js  encoder.js  env.js  global-context.js  low-level.js  manager.js  node.js  opcode-compiler.js  owner.js  program.js  reference.js  runtime.js  util.js  validator.js  vm.js  wire-format.js

the same path does not exist in my app’s local node_modules

ls frontend/node_modules/ember-source/
ls: cannot access 'frontend/node_modules/ember-source/': No such file or directory

in my app’s package.json:

"ember-source": "3.27.1", (and higher, 3.28 beta, 4 alpha)
"ember-cli-babel": "^7.26.6",
"@glimmer/syntax": "^0.79.1",

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ef4commented, May 20, 2021

It’s hard to fix your case without breaking the built-in case.

One workaround you can try, since you have a monorepo anyway, is to import from @glimmer/syntax in a new package that is not an ember addon. By doing it in code that’s “not ember code”, you avoid some of these compatibility features. That new package can then reexport the things you need and the app can import them from the new package.

Another option is to find what you need from inside ember-source/dist/template-compiler.js. That is what embroider itself does to get access to @glimmer/syntax, and that is how mho gets access to the template compiler from within a service worker.

0reactions
NullVoxPopulicommented, May 28, 2021

idk if I’ve created too many x/y problems by doing this, but, I think we can close this issue, as the recommendation is to either:

  • use the builtin export
  • or pre-build the thing using @glimmer/syntax
Read more comments on GitHub >

github_iconTop Results From Across the Web

[Embroider] dependencySatisfies gives wrong answer for ...
Hey, I have a similar problem to Help needed - struggling to find/resolve a deprecation : I'm trying to get rid of the...
Read more >
node.js - Typescript builds files with incorrect path in monorepo
Ok, so to fix this I had to change the package.json instead of the tsconfig.json . Making the main field in shared/package-json point...
Read more >
Things I wish I had known when I started JavaScript monorepo ...
Monorepo must have a mechanism how to interconnect packages and allow us to use one package code within another. Dependency management.
Read more >
A guide through The Wild Wild West of setting up a mono repo ...
This is were the fun starts! Setting up a mono repo from scratch. We will be using TypeScript, Yarn workspaces, Lerna, and Jest....
Read more >
Configuring TypeScript for multiple packages in a Lerna + ...
json file which contains the configuration for your mono-repo. 2. Setup yarn workspaces. In your lerna.json add the following: 3.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found