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.

TokContext is not a constructor

See original GitHub issue

Hi there!

I’m eager to try out spectacle but unfortunately I’m running into some problems that I can not seem to fix!

Prerequisites

Feel free to delete this section if you have checked off all of the following.

  • [V] I’ve searched open issues to make sure I’m not opening a duplicate issue
  • [V] This issue not specific to spectacle-boilerplate (those issues should be opened here).
  • [V] I have read through the docs before asking a question
  • [V] I am using the latest version of Spectacle

Describe Your Environment

What version of Spectacle are you using? (can be found by running npm list spectacle) └─┬ spectacle-scripts@2.0.0 └── spectacle@4.4.1

What version of React are you using? (can be found by running npm list react) talk-251018-workers@0.1.0 /Users/timkuilman/Projects/talk-251018-workers └── react@16.5.2 What browser are you using? Firefox / Chrome

What machine are you on? Macbook

Describe the Problem

I created a new project running npx create-react-app my-presentation --scripts-version spectacle-scripts. After that I ran yarn and yarn start. The browser pops up opening localhost:3000 but outputs an error. (Included at the end of this issue)

Expected behavior: [What you expect to happen] No errors 😃

Actual behavior: [What actually happens] See the error at ‘browser output’

browser output

TypeError: TokContext is not a constructor
./node_modules/buble/dist/buble-browser.es.js/<
node_modules/buble/dist/buble-browser.es.js:271

  268 | var isIdentifierStart = require$$0.isIdentifierStart;
  269 | var isIdentifierChar = require$$0.isIdentifierChar;
  270 | 
> 271 | var tc_oTag = new TokContext('<tag', false);
  272 | var tc_cTag = new TokContext('</tag', false);
  273 | var tc_expr = new TokContext('<tag>...</tag>', true, true);
  274 | 

./node_modules/buble/dist/buble-browser.es.js
node_modules/buble/dist/buble-browser.es.js:1

> 1 | import require$$0, { Parser } from 'acorn';
  2 | import MagicString from 'magic-string';
  3 | 
  4 | var xhtml = {

__webpack_require__
/Users/timkuilman/Projects/talk-251018-workers/webpack/bootstrap f65e30097adc8a72858b:678

  675 | };
  676 | 
  677 | // Execute the module function
> 678 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
  679 | 
  680 | // Flag the module as loaded
  681 | module.l = true;

fn
/Users/timkuilman/Projects/talk-251018-workers/webpack/bootstrap f65e30097adc8a72858b:88

  85 | 		console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId);
  86 | 		hotCurrentParents = [];
  87 | 	}
> 88 | 	return __webpack_require__(request);
  89 | };
  90 | var ObjectFactory = function ObjectFactory(name) {
  91 | 	return {

./node_modules/react-live/dist/react-live.es.js
node_modules/react-live/dist/react-live.es.js:1

> 1 | import { highlight, languages } from 'prismjs/components/prism-core';
  2 | import 'prismjs/components/prism-clike';
  3 | import 'prismjs/components/prism-javascript';
  4 | import 'prismjs/components/prism-markup';

__webpack_require__
/Users/timkuilman/Projects/talk-251018-workers/webpack/bootstrap f65e30097adc8a72858b:678

  675 | };
  676 | 
  677 | // Execute the module function
> 678 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
  679 | 
  680 | // Flag the module as loaded
  681 | module.l = true;

fn
/Users/timkuilman/Projects/talk-251018-workers/webpack/bootstrap f65e30097adc8a72858b:88

  85 | 		console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId);
  86 | 		hotCurrentParents = [];
  87 | 	}
> 88 | 	return __webpack_require__(request);
  89 | };
  90 | var ObjectFactory = function ObjectFactory(name) {
  91 | 	return {

./node_modules/spectacle/es/components/code-pane.js
node_modules/spectacle/es/components/code-pane.js:1

> 1 | function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  2 | 
  3 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4 | 

__webpack_require__
/Users/timkuilman/Projects/talk-251018-workers/webpack/bootstrap f65e30097adc8a72858b:678

  675 | };
  676 | 
  677 | // Execute the module function
> 678 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
  679 | 
  680 | // Flag the module as loaded
  681 | module.l = true;

fn
/Users/timkuilman/Projects/talk-251018-workers/webpack/bootstrap f65e30097adc8a72858b:88

  85 | 		console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId);
  86 | 		hotCurrentParents = [];
  87 | 	}
> 88 | 	return __webpack_require__(request);
  89 | };
  90 | var ObjectFactory = function ObjectFactory(name) {
  91 | 	return {

./node_modules/spectacle/es/index.js
node_modules/spectacle/es/index.js:1

> 1 | import Anim from './components/anim';
  2 | import Appear from './components/appear';
  3 | import BlockQuote from './components/block-quote';
  4 | import Cite from './components/cite';

__webpack_require__
/Users/timkuilman/Projects/talk-251018-workers/webpack/bootstrap f65e30097adc8a72858b:678

  675 | };
  676 | 
  677 | // Execute the module function
> 678 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
  679 | 
  680 | // Flag the module as loaded
  681 | module.l = true;

fn
/Users/timkuilman/Projects/talk-251018-workers/webpack/bootstrap f65e30097adc8a72858b:88

  85 | 		console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId);
  86 | 		hotCurrentParents = [];
  87 | 	}
> 88 | 	return __webpack_require__(request);
  89 | };
  90 | var ObjectFactory = function ObjectFactory(name) {
  91 | 	return {

./src/presentation.js
http://localhost:3000/static/js/bundle.js:107362:68
__webpack_require__
/Users/timkuilman/Projects/talk-251018-workers/webpack/bootstrap f65e30097adc8a72858b:678

  675 | };
  676 | 
  677 | // Execute the module function
> 678 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
  679 | 
  680 | // Flag the module as loaded
  681 | module.l = true;

fn
/Users/timkuilman/Projects/talk-251018-workers/webpack/bootstrap f65e30097adc8a72858b:88

  85 | 		console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId);
  86 | 		hotCurrentParents = [];
  87 | 	}
> 88 | 	return __webpack_require__(request);
  89 | };
  90 | var ObjectFactory = function ObjectFactory(name) {
  91 | 	return {

./src/index.js
http://localhost:3000/static/js/bundle.js:107332:72
__webpack_require__
/Users/timkuilman/Projects/talk-251018-workers/webpack/bootstrap f65e30097adc8a72858b:678

  675 | };
  676 | 
  677 | // Execute the module function
> 678 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
  679 | 
  680 | // Flag the module as loaded
  681 | module.l = true;

fn
/Users/timkuilman/Projects/talk-251018-workers/webpack/bootstrap f65e30097adc8a72858b:88

  85 | 		console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId);
  86 | 		hotCurrentParents = [];
  87 | 	}
> 88 | 	return __webpack_require__(request);
  89 | };
  90 | var ObjectFactory = function ObjectFactory(name) {
  91 | 	return {

0
http://localhost:3000/static/js/bundle.js:107772:18
__webpack_require__
/Users/timkuilman/Projects/talk-251018-workers/webpack/bootstrap f65e30097adc8a72858b:678

  675 | };
  676 | 
  677 | // Execute the module function
> 678 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
  679 | 
  680 | // Flag the module as loaded
  681 | module.l = true;

(anonymous function)
/Users/timkuilman/Projects/talk-251018-workers/webpack/bootstrap f65e30097adc8a72858b:724

  721 | __webpack_require__.h = function() { return hotCurrentHash; };
  722 | 
  723 | // Load entry module and return exports
> 724 | return hotCreateRequire(0)(__webpack_require__.s = 0);
  725 | 
  726 | 
  727 | 

(anonymous function)
http://localhost:3000/static/js/bundle.js:1:11
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
ssmyczynskicommented, Oct 22, 2018

Found solution somewhere else:

npm install buble@0.19.4

Works for me. (https://github.com/pedronauck/docz/issues/416#issuecomment-430520805)

1reaction
jtiscionecommented, Oct 22, 2018

Success here also, with the “classic setup” created by npx create-react-app my-presentation --scripts-version spectacle-scripts. I inserted “buble”: “0.19.4” in package.json (i.e. the exact version).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use the acorn.tokTypes function in acorn - Snyk
Use Snyk Code to scan source code in minutes - no build needed - and fix issues ... Constructor) { if (!(instance instanceof...
Read more >
guest/perforce_software/helix-web-services/main/source ... - Swarm
whitespace"; export class TokContext {; constructor(token, isExpr, preserveSpace, override) {; this.token = token; this.isExpr = isExpr; this.
Read more >
RFC 8353 - Generic Security Service API Version 2: Java ...
Generic Security Service API Version 2: Java Bindings Update RFC 8353 · 1. Constructors public ChannelBinding(InetAddress initAddr, InetAddress acceptAddr, byte ...
Read more >
nltk.sem.linearlogic module
If 'other' is a variable, then it must not be bound to anything other than ... that the application is valid since the...
Read more >
Notebook stepper / Bryan Gin-ge Chen | Observable
Note that import variables do not (currently?) appear and the values of view ... Similarly, the Variable constructor accepts an additional caller argument ......
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