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.

Error: Found extraneous } in Chalk template literal

See original GitHub issue

Steps to reproduce:

  1. Copy the code from Creating-middleware to a file named mw-example.js.
module.exports = MiddlewareBase => class Example extends MiddlewareBase {
  middleware (options) {
    return (ctx, next) => {
      ctx.response.body = 'Hello'
    }
  }
}
  1. In the terminal write ./node_modules/.bin/ws --stack mw-example.js --help if installed locally.

Error:

Error: Found extraneous } in Chalk template literal
    at tmp.replace (/node_modules/chalk/templates.js:109:11)
    at String.replace (<anonymous>)
    at module.exports (/node_modules/chalk/templates.js:99:6)
    at chalkTag (/node_modules/chalk/index.js:221:9)
    at Chalk.chalk.template (/node_modules/chalk/index.js:36:20)
    at format (/node_modules/command-line-usage/lib/chalk-format.js:4:10)
    at chalkFormat (/node_modules/command-line-usage/lib/chalk-format.js:10:12)
    at ansiFormatRow (/node_modules/command-line-usage/lib/content.js:76:16)
    at content.map.row (/node_modules/command-line-usage/lib/content.js:35:52)
    at Stack.map (<anonymous>)

Edit: removed beginning of paths in error output for brevity

local-web-server version: 2.6.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
75lbcommented, May 21, 2019

Fixed and released in lws v1.3.2, please re-install local-web-server to pick up the change. Thanks for letting me know. 👍

0reactions
75lbcommented, May 24, 2019

I thought lws was the supported project since the commits was much newer.

Makes sense… I’m actually working on both projects atm.

Could you comment be added to the lws README?

Yes, I will clarify everything in the README as part of the next release, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Better documentation of escape characters to avoid: throw ...
Hi I hit this error while using template literals for a long string. ... throw new Error('Found extraneous } in Chalk template literal');...
Read more >
chalk tagged template literals within strings - Stack Overflow
i found a proxy for chalk that does just this const chalk = require("chalk"); const chalkish = (parts, ...substitutions) => { const ...
Read more >
Template literals (Template strings) - JavaScript | MDN
Template literals are literals delimited with backtick (`) characters, allowing for multi-line strings, string interpolation with embedded ...
Read more >
chalk-template - npm
Terminal string styling with tagged template literals. ... Start using chalk-template in your project by running `npm i chalk-template`.
Read more >
restrict-template-expressions - TypeScript ESLint
This rule reports on values used in a template literal string that aren't primitives and don't define a more useful .toString() method. .eslintrc.cjs....
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