TemplateCompiler `cannot read property 'visitor' of undefined`
See original GitHub issueI’m currently diagnosing an issue that cropped up with the recent ember-canary/ember-beta’s (todays), it may not be a bug with Ember.js itself, but rather some other part of our default system that is now getting tripped up.
Stack Strace:
TypeError: Cannot read property 'visitor' of undefined
at preprocess (/private/var/folders/9n/_xy74rdd4m3063fr5kqdl5vc000mw4/T/embroider/cb03bb/packages/router/node_modules/ember-source/vendor/ember/ember-template-compiler.js:12246:42)
at normalize (/private/var/folders/9n/_xy74rdd4m3063fr5kqdl5vc000mw4/T/embroider/cb03bb/packages/router/node_modules/ember-source/vendor/ember/ember-template-compiler.js:12906:15)
at precompileJSON (/private/var/folders/9n/_xy74rdd4m3063fr5kqdl5vc000mw4/T/embroider/cb03bb/packages/router/node_modules/ember-source/vendor/ember/ember-template-compiler.js:5402:47)
at precompile (/private/var/folders/9n/_xy74rdd4m3063fr5kqdl5vc000mw4/T/embroider/cb03bb/packages/router/node_modules/ember-source/vendor/ember/ember-template-compiler.js:5435:31)
at Object.precompile (/private/var/folders/9n/_xy74rdd4m3063fr5kqdl5vc000mw4/T/embroider/cb03bb/packages/router/node_modules/ember-source/vendor/ember/ember-template-compiler.js:19197:37)
at NodeTemplateCompiler.precompile (/Users/spenner/src/embroider-build/embroider/packages/core/src/template-compiler-common.js:71:36)
at NodeTemplateCompiler.compile (/Users/spenner/src/embroider-build/embroider/packages/core/src/template-compiler-common.js:87:47)
at NodeTemplateCompiler.compile (/Users/spenner/src/embroider-build/embroider/packages/core/src/template-compiler-node.js:23:25)
at Object.hbsLoader (/Users/spenner/src/embroider-build/embroider/packages/hbs-loader/src/index.js:9:16)
at LOADER_EXECUTION (/Users/spenner/src/embroider-build/embroider/node_modules/loader-runner/lib/LoaderRunner.js:132:14)
```
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:15 (6 by maintainers)
Top Results From Across the Web
Template Compiler Error (TemplateCompiler) in ember-paper ...
My ember application started showing below error while building the app (Initially it was working and without any code change, build started ...
Read more >Ember build failed with deprection message
Hi my ember project buld fails with the following error message and I have no idea in how to solve this issue: ember-cli:...
Read more >cannot read property of undefined karma test - You.com
AuthenticationService should be created TypeError: Cannot read property 'authenticationStatus' of undefined It has something to do with the getter of ...
Read more >uniapp uview2.0.23版本组件报错- 完竣世界 - vue开发
TypeError: Cannot read property 'name' of undefined 15:18:22.800 at ... /node_modules/@dcloudio/uni-template-compiler/lib/script/traverse/visitor.js:186:58) ...
Read more >Build a Secure Node.js App with SQL Server - Okta Developer
c:\Projects\okta>node . Server running at http://localhost:8080… TypeError: Cannot read property 'request' of undefined at Object.getEvents (c:\ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok. Solution: Ensure your template compiler plugins follow the new form only.
In my case, ember-cli-template-lint’s plugins where simply incompatible with the new plugin form introduced by https://github.com/glimmerjs/glimmer-vm/commit/28652d4ea214f1c7bf0251d4b4b23853d9f0a787, and required upgrading to
ember-template-lint
. Given thatember-cli-template-lint
is deprecated, in this scenario it is likely perfectly reasonable solution.That being said, the debugging on this is quite sub-optimal, and I although I hope folks running into this problem at helped by this issue, i suspect (assuming the above is a reasonable change) that better detection of the failure mode could go a long way. Specifically https://github.com/glimmerjs/glimmer-vm/blob/ef92c497c3d921af22b38a54eac1445c204c3370/packages/%40glimmer/syntax/lib/parser/tokenizer-event-handlers.ts#L447 could detect a return value without
{ visitor() { } }
and provide throw an actionable error@JenLyndle The issue with
ember-cp-validations
is most likely due to the deprecation that was cleaned up in #19429 for disallowing legacy class-based AST plugins. It looks like @Turbo87 fixed this issue in qonto/ember-cp-validations#3, but that’s a fork of the addon that doesn’t appear to be published to NPM. The original addon hasn’t been touched since April 2021.