ReferenceError: __dirname is not defined
See original GitHub issuev1.4.0 worked fine.
v2.1.1 throws the following error:
vendor.js:137754 Uncaught (in promise) ReferenceError: __dirname is not defined
at push../node_modules/http-status-codes/build/index.js.module.exports.527 (vendor.js:137754)
at Object../node_modules/http-status-codes/build/index.js (vendor.js:137787)
at __webpack_require__ (vendor.js:105790)
I’m using it like this (example reduced to minimal case):
import { StatusCodes } from "http-status-codes";
console.log(StatusCodes.UNAUTHORIZED);
Culprit: build/index.js:38
/******/ __webpack_require__.ab = __dirname + "/";
http-status-codes: 2.1.1 Environment: Ember 3.18 Node: 12.18.3 Browser: Chrome 84
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Why is __dirname not defined in node REPL?
__dirname is only defined in scripts. It's not available in REPL. try make a script a.js console.log(__dirname);. and run it: node a.js.
Read more >How to fix "__dirname is not defined in ES module scope"
I stumbled on this error while I used __dirname inside a ES module. In an ES module, you cannot use __dirname . Using...
Read more >__dirname is not defined · Issue #2907 · nodejs/help · ...
I wrote a simple program: console.log('Hello world'); console.log(__dirname); Error: Hello world file:///C:/prj/akb48teamsh/html/t.js:2 ...
Read more >Fix "__dirname is not defined in ES module scope" in ...
One error you'll likely run into is "Uncaught ReferenceError: __dirname is not defined in ES module scope". This error is exactly what it ......
Read more >Fix "__dirname is not defined in ES module scope" in JS
To solve the "__dirname is not defined in ES module scope" error, import and use the dirname() method from the path module. The...
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
Sorry about that. This should be resolved now in v2.1.2
@elkinjosetm Can you try this beta version and let me know if it solves your issue?
http-status-codes@2.1.3-beta.0