Cannot read property 'rest' of undefined when using bash language
See original GitHub issueHello,
I was trying to use this great projet but i keep getting this error :
[2017-04-20 17:46:49.682] [ERROR] prizmLogs - TypeError: Cannot read property 'rest' of undefined
at Object.tokenize (C:\Sources\TCN\prizmLogs\node_modules\prismjs\prism.js:265:21)
at Object.highlight (C:\Sources\TCN\prizmLogs\node_modules\prismjs\prism.js:256:18)
at C:\Sources\TCN\prizmLogs\routes\logs.js:36:22
at Layer.handle [as handle_request] (C:\Sources\TCN\prizmLogs\node_modules\express\lib\router\layer.js:95:5)
at next (C:\Sources\TCN\prizmLogs\node_modules\express\lib\router\route.js:137:13)
at Route.dispatch (C:\Sources\TCN\prizmLogs\node_modules\express\lib\router\route.js:112:3)
at Layer.handle [as handle_request] (C:\Sources\TCN\prizmLogs\node_modules\express\lib\router\layer.js:95:5)
at C:\Sources\TCN\prizmLogs\node_modules\express\lib\router\index.js:281:22
at Function.process_params (C:\Sources\TCN\prizmLogs\node_modules\express\lib\router\index.js:335:12)
at next (C:\Sources\TCN\prizmLogs\node_modules\express\lib\router\index.js:275:10)
I used your basic exemple :
const prism = require('prismjs
let body = 'test';
try{
body = prism.highlight(body, prism.languages.bash);
}catch(err){
logger.error(err);
body = err.message;
}
Nothing too fancy as you can see. Node version is 7.7.3 and npm version is 4.1.2.
Did i miss something ? like the fact that it’s not compatible with node 7.7.3 or whatever ?
Theo
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
path - VS code error: Cannot read properties of undefined ...
The "Cannot read properties of undefined" error occurs with the JavaScript of VC Code when you try to access a property or a...
Read more >cannot read properties of undefined (reading 'listen') - You.com
I'm trying to get messages from a WebSocket to make assertions using Cypress. I used the example from the website link to do...
Read more >Loop the loop: TypeError: Cannot read property 'name' of ...
Can anybody please tell me what is wrong with this code: // Our Person constructor ... Loop the loop: TypeError: Cannot read property...
Read more >Bash Reference Manual - GNU.org
Your users will use the LANG or LC_MESSAGES shell variables to select the desired language. You set the TEXTDOMAIN variable to the script's ......
Read more >Language Server Extension Guide - Visual Studio Code
First, Language Servers are usually implemented in their native programming languages, and that presents a challenge in integrating them with VS Code, which...
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 Free
Top 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
prism.languages.bash
is probably undefined. When you require prismjs in node, you need to import the components: require(‘prismjs/components/bash’) or whatever the exact path is.This:
require('prismjs/components/bash')
->require('prismjs/components/prism-bash')
. I didn’t type out the whole path.