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.

ReferenceError: window is not defined

See original GitHub issue

In Node REPL when I type const mermaid = require('mermaid'); it tell me

ReferenceError: window is not defined at new Log (/[my project]/node_modules/mermaid/src/logger.js:87:18) at Object.<anonymous> (/[my project]/node_modules/mermaid/src/mermaid.js:8:11) at Module._compile (module.js:571:32) at Object.Module._extensions…js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at repl:1:17

And I try to install it with these ways: npm install mermaid npm install git+https://github.com/knsv/mermaid.git but it still not work.

My Node version is v7.7.1, and npm version is 4.1.2

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
jbmussocommented, Jan 7, 2019

Unsure if this is expected, but it looks like mermaid v8.0.0 cannot be used in Node.js (window is not defined error). Using mermaid v7.1.0 seems to work fine though.

0reactions
davibecommented, Jul 26, 2019

I wanted to use mermaid JS while transpiling markdown to html+js+css. During transpilation I do not have a browser environment available (normally).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to solve "window is not defined" errors in React and ...
How to solve "window is not defined" errors in React and Next.js · 1. First solution: typeof · 2. Second solution: the useEffect...
Read more >
How to solve Next.js window is not defined
ReferenceError: window is not defined is a pretty common error you may run into when using Next.js for the first time but don't...
Read more >
referenceerror: window is not defined, how to solve
Here's how to fix the “referenceerror: window is not defined” error that you might have in Node.js or with a tool like Next.js....
Read more >
How To Solve ReferenceError window is not defined in ...
Fixing a window is not defined error can be quite simple. In most cases, all you will need to do is wrap your...
Read more >
[Solved] ReferenceError : window is not defined - ItsJavaScript
The ReferenceError : window is not defined error mainly occurs if you are using the window object in Node.js, React.js, Next.js.
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