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.

ci-info module throw error for "process is not defined"

See original GitHub issue

Version

1.3.0

Reproduction link

https://codepen.io/timyaodpc/pen/bMyazm

Steps to reproduce

Use it in Nuxt/plugins/myplugin.js.

It all works but in browser console it give me a error says "process is not defined". Error points to "ci-info" module first line which tries to use process.env.

I can see ci-info is a dependency of consola as below:

└─┬ consola@1.3.0 └─┬ std-env@1.3.0 └─┬ is-ci@1.1.0 └── ci-info@1.1.3

I now have to add isServer condition on const consola = require('consola'). Otherwise it breaks the client side.

What is expected ?

Browser should no error in console.

What is actually happening?

A error from ci-info says “process is not defined”.

index.js:3 Uncaught ReferenceError: process is not defined at Object…/node_modules/ci-info/index.js (index.js:3) at webpack_require (bootstrap 20212f6dd5b287d60bc9:712) at fn (bootstrap 20212f6dd5b287d60bc9:117) at Object…/node_modules/is-ci/index.js (index.js:3) at webpack_require (bootstrap 20212f6dd5b287d60bc9:712) at fn (bootstrap 20212f6dd5b287d60bc9:117) at Object.<anonymous> (index.js:1) at Object…/node_modules/std-env/index.js (index.js:18) at webpack_require (bootstrap 20212f6dd5b287d60bc9:712) at fn (bootstrap 20212f6dd5b287d60bc9:117)

Additional comments?

Is Consola can only be used in server side js? The consola code index.js first line imported std-env which can only used in server side. https://github.com/nuxt/consola/blob/master/src/index.js#L1 Not sure which is the best way to use it in Nuxt and maybe it’s a bug?

<div align="right">This bug report is available on Nuxt.js community (#c32)</div>

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
manniLcommented, Nov 2, 2018

image ❤️

2reactions
pi0commented, Nov 2, 2018

Official browser support has arrived with v2.0.0. It only takes 1.5KB / Gzipped for the browser.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ci-info module throw error for "process is not defined" · Issue #19
Use it in Nuxt/plugins/myplugin.js. It all works but in browser console it give me a error says "process is not defined" . Error...
Read more >
ReferenceError 'process not defined' when executing Cypress ...
Trying to execute any of the tests leads to this error popping up. I am using Cypress 6.5.0.
Read more >
ReferenceError: “process is not defined” - GIMTEC
In NodeJS, “process” is defined, but not in the browser. This is because NodeJS and the browser are different runtime environments. Common Error....
Read more >
Uncaught ReferenceError: process is not defined
The error Uncaught ReferenceError: process is not defined may happen when the code tries to get access to the process object that provides ......
Read more >
throw - JavaScript - MDN Web Docs - Mozilla
The throw statement throws a user-defined exception. ... If no catch block exists among caller functions, the program will terminate.
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