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.

"node" environment is missing `URL` global

See original GitHub issue

Tell us about your environment

  • ESLint Version: 4.19.1
  • Node Version: 10.0.0
  • npm Version: 5.6.0

What parser (default, Babel-ESLint, etc.) are you using? babel-eslint@8.2.3

Please show your full configuration:

Configuration
{
  "env": {
    "jest": true,
    "node": true
  },

  "extends": [
    "bespoke",
    "plugin:react/recommended"
  ],

  "parser": "babel-eslint"
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

new URL(import.meta.url).pathname
eslint --ext .mjs --ignore-path .gitignore .

What did you expect to happen?

URL to be a known global when specifying "node": true. (SEE https://nodejs.org/api/url.html)

What actually happened? Please include the actual, raw output from ESLint.

4:17  error  'URL' is not defined                      no-undef

I’m using babel-eslint until import.meta is more widely supported.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
kaicataldocommented, Jul 23, 2018

It looks like this was added in globals v11.5, which we updated to in ESLint v5. Updating to the latest version of ESLint will fix this. Thanks!

0reactions
platinumazurecommented, Oct 30, 2018

@medikoo That would result in a larger maintenance burden for us as different Node versions go into or out of LTS. I’m not sure we have the resources to maintain the Node globals as you suggested. That is why I offered the workaround.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[node] Missing global URL and URLSearchParams typings
Therefore the global URL and URLSearchParams has been removed again. This fix (actually a workaround for a missing declaration merging feature ...
Read more >
dotenv file is not loading environment variables - Stack Overflow
This solved my issues in Node v8.14.1 : const path = require('path') require('dotenv').config({ path: path.resolve(__dirname, '../.env') }).
Read more >
Working with Environment Variables in Node.js - Twilio
Environment variables are a great way to configure parts of your Node.js application. Learn how to work with them using helpful tools such ......
Read more >
Using Environment Variables in Node.js for App Configuration ...
Learn why experienced Node.js developers use environment variables for app config and secrets, including how to manage default values and ...
Read more >
Configure Node.js apps - Azure App Service - Microsoft Learn
Learn how to configure a Node.js app in the native Windows instances, or in a pre-built Linux container, in Azure App Service.
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