embroider-build / embroider

Compiling Ember apps into spec-compliant, modern Javascript.
MIT License
339 stars 140 forks source link

broccoliBuilderErrorStack: Error: Cannot find module './vendor/ember-cli/vendor-prefix.js #1165

Open Sabari-Rajan-E3352 opened 2 years ago

Sabari-Rajan-E3352 commented 2 years ago

Ember version: "3.20.2" "@embroider/compat": "^1.5.0", "@embroider/core": "^1.5.0", "@embroider/webpack": "^1.5.0",

ERROR Summary:

ef4 commented 2 years ago

Thanks for reporting. I'm not sure how to reproduce this. Maybe you can try eliminating addons to see if one is responsible.

vendor-prefix.js is a thing added by ember-cli itself.

toddjordan commented 4 months ago

Its been a while since this was opened, but I'm hitting the same issue in trying to enable embroider in our app, (ember-cli 4.8.1, @embroider/compat 3.5.7, @embroider/core 3.4.14, @embroider/webpack 4.0.4). For me its being put in synthesized-vendor/package.json as part of "implicit-scripts", but the vendor-prefix.js file isn't in "./vendor/ember-cli/vendor-prefix.js" like "implicit-scripts" is pointing to.

My question is how is "implicit-scripts" populated, and how are scripts copied into "synthesized-vendor"? I'm assuming there's a script in an addon or dependency that is referencing it?

toddjordan commented 4 months ago

@Sabari-Rajan-E3352 did you figure out what was causing this for you? (maybe it is a similar addon/dependency)

toddjordan commented 4 months ago

Update: was able to get around the error by commenting out/skipping some stuff we were doing in the app's ember-cli-build. Next i'll start trying to get it back running to see what exactly was the culprit. I'll update here when I find something.

mansona commented 4 months ago

@toddjordan it would also be useful to see what your error stack was, the one in the original report is very out of date now 🙈 so the stack isn't all that useful to track it down

toddjordan commented 4 months ago

Hey Chris, you got it:

ERROR Summary:

  - broccoliBuilderErrorStack: Error: Cannot find module './vendor/ember-cli/vendor-prefix.js' from '/Users/tjordan/dev/q2/ngam/packages/q2-app/node_modules/.embroider/rewritten-packages/@embroider/synthesized-vendor'
    at Function.resolveSync [as sync] (/Users/tjordan/dev/q2/ngam/node_modules/resolve/lib/sync.js:111:15)
    at CompatAppBuilder.impliedAddonAssets (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app-builder.js:361:55)
    at CompatAppBuilder.impliedAssets (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app-builder.js:293:27)
    at CompatAppBuilder.implicitScriptsAsset (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app-builder.js:492:40)
    at CompatAppBuilder.insertEmberApp (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app-builder.js:458:29)
    at CompatAppBuilder.prepareAsset (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app-builder.js:663:18)
    at CompatAppBuilder.prepareAssets (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app-builder.js:673:18)
    at CompatAppBuilder.updateAssets (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app-builder.js:740:27)
    at CompatAppBuilder.build (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app-builder.js:819:38)
    at WaitForTrees.buildHook (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app.js:670:35)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async TransformNodeWrapper.build (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/node_modules/broccoli/dist/wrappers/transform-node.js:68:13)
    at async /Users/tjordan/dev/q2/ngam/node_modules/ember-cli/node_modules/broccoli/dist/builder.js:185:21
    at async Builder.build (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/node_modules/broccoli/dist/builder.js:204:13)
    at async Builder.build (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/models/builder.js:197:11)
    at async BuildTask.run (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/tasks/build.js:32:21)
    at async Class.run (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/commands/build.js:29:5)
    at async /Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/cli/cli.js:206:32
    at async CLI.run (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/cli/cli.js:253:14)
    at async module.exports (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/cli/index.js:145:12)
  - code: [undefined]
  - codeFrame: Cannot find module './vendor/ember-cli/vendor-prefix.js' from '/Users/tjordan/dev/q2/ngam/packages/q2-app/node_modules/.embroider/rewritten-packages/@embroider/synthesized-vendor'
  - errorMessage: Cannot find module './vendor/ember-cli/vendor-prefix.js' from '/Users/tjordan/dev/q2/ngam/packages/q2-app/node_modules/.embroider/rewritten-packages/@embroider/synthesized-vendor'
        at WaitForTrees (@embroider/compat/app)
-~- created here: -~-
    at new Plugin (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/core/node_modules/broccoli-plugin/dist/index.js:47:36)
    at new WaitForTrees (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/core/src/wait-for-trees.js:30:9)
    at tree (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app.js:663:20)
    at Object.get tree [as tree] (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app.js:681:24)
    at new PackagerRunner (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/core/src/to-broccoli-plugin.js:12:26)
    at Object.defaultPipeline (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/default-pipeline.js:38:12)
    at module.exports (/Users/tjordan/dev/q2/ngam/packages/q2-app/ember-cli-build.js:248:41)
    at Builder.readBuildFile (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/models/builder.js:49:14)
    at Builder.setupBroccoliBuilder (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/models/builder.js:63:22)
    at new Builder (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/models/builder.js:29:10)
    at BuildTask.run (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/tasks/build.js:13:19)
    at /Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/models/command.js:238:24
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Class.run (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/commands/build.js:29:5)
    at async /Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/cli/cli.js:206:32
    at async CLI.run (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/cli/cli.js:253:14)
    at async module.exports (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/cli/index.js:145:12)
-~- (end) -~-
  - errorType: Build Error
  - location:
    - column: [undefined]
    - file: [undefined]
    - line: [undefined]
    - treeDir: [undefined]
  - message: Cannot find module './vendor/ember-cli/vendor-prefix.js' from '/Users/tjordan/dev/q2/ngam/packages/q2-app/node_modules/.embroider/rewritten-packages/@embroider/synthesized-vendor'
        at WaitForTrees (@embroider/compat/app)
-~- created here: -~-
    at new Plugin (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/core/node_modules/broccoli-plugin/dist/index.js:47:36)
    at new WaitForTrees (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/core/src/wait-for-trees.js:30:9)
    at tree (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app.js:663:20)
    at Object.get tree [as tree] (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app.js:681:24)
    at new PackagerRunner (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/core/src/to-broccoli-plugin.js:12:26)
    at Object.defaultPipeline (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/default-pipeline.js:38:12)
    at module.exports (/Users/tjordan/dev/q2/ngam/packages/q2-app/ember-cli-build.js:248:41)
    at Builder.readBuildFile (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/models/builder.js:49:14)
    at Builder.setupBroccoliBuilder (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/models/builder.js:63:22)
    at new Builder (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/models/builder.js:29:10)
    at BuildTask.run (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/tasks/build.js:13:19)
    at /Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/models/command.js:238:24
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Class.run (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/commands/build.js:29:5)
    at async /Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/cli/cli.js:206:32
    at async CLI.run (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/cli/cli.js:253:14)
    at async module.exports (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/cli/index.js:145:12)
-~- (end) -~-
  - name: Error
  - nodeAnnotation: @embroider/compat/app
  - nodeName: WaitForTrees
  - originalErrorMessage: Cannot find module './vendor/ember-cli/vendor-prefix.js' from '/Users/tjordan/dev/q2/ngam/packages/q2-app/node_modules/.embroider/rewritten-packages/@embroider/synthesized-vendor'
  - stack: Error: Cannot find module './vendor/ember-cli/vendor-prefix.js' from '/Users/tjordan/dev/q2/ngam/packages/q2-app/node_modules/.embroider/rewritten-packages/@embroider/synthesized-vendor'
    at Function.resolveSync [as sync] (/Users/tjordan/dev/q2/ngam/node_modules/resolve/lib/sync.js:111:15)
    at CompatAppBuilder.impliedAddonAssets (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app-builder.js:361:55)
    at CompatAppBuilder.impliedAssets (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app-builder.js:293:27)
    at CompatAppBuilder.implicitScriptsAsset (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app-builder.js:492:40)
    at CompatAppBuilder.insertEmberApp (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app-builder.js:458:29)
    at CompatAppBuilder.prepareAsset (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app-builder.js:663:18)
    at CompatAppBuilder.prepareAssets (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app-builder.js:673:18)
    at CompatAppBuilder.updateAssets (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app-builder.js:740:27)
    at CompatAppBuilder.build (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app-builder.js:819:38)
    at WaitForTrees.buildHook (/Users/tjordan/dev/q2/ngam/node_modules/@embroider/compat/src/compat-app.js:670:35)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async TransformNodeWrapper.build (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/node_modules/broccoli/dist/wrappers/transform-node.js:68:13)
    at async /Users/tjordan/dev/q2/ngam/node_modules/ember-cli/node_modules/broccoli/dist/builder.js:185:21
    at async Builder.build (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/node_modules/broccoli/dist/builder.js:204:13)
    at async Builder.build (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/models/builder.js:197:11)
    at async BuildTask.run (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/tasks/build.js:32:21)
    at async Class.run (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/commands/build.js:29:5)
    at async /Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/cli/cli.js:206:32
    at async CLI.run (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/cli/cli.js:253:14)
    at async module.exports (/Users/tjordan/dev/q2/ngam/node_modules/ember-cli/lib/cli/index.js:145:12)
mansona commented 4 months ago

so if you dropped a debugger in your node modules @embroider/compat/src/compat-app-builder where the error is happening you will be able to see what addon is causing the problem. that will get you much closer to what is actually causing the issue

here is the relevant code on the stable branch (not the same line because TypeScript 🫠 ) https://github.com/embroider-build/embroider/blob/stable/packages/compat/src/compat-app-builder.ts#L404-L412

toddjordan commented 4 months ago

Thanks for the tip. Will take a look today.