3,224 questions
3 votes
3 answers
1k views
How to use uuid with Node.js (v20) when require() throws ERR_REQUIRE_ESM?
I'm building a URL shortener app in Node.js (v20.16.0) using Express. In my controller/user.js, I try to import uuid like this: const { v4: uuidv4 } = require('uuid'); But when I run npm start, I get ...
3 votes
1 answer
133 views
how to refer to a sub exported by a module when using require?
Background: There are a number of modules in the local lib eg Eg-1.rakumod Eg-2.rakumod Eg-3.rakumod, each Eg-\d is referenced in META6.json file, and each module has the code sub SITE is export { ... ...
6 votes
3 answers
7k views
[runtime not ready]: ReferenceError: Property 'require' doesn't exist, js engine: hermes
I’m working on a React Native project using Expo SDK 53 and React Native 0.79.2. When running the app, I get this runtime error: [runtime not ready]: ReferenceError: Property 'require' doesn't exist, ...
0 votes
1 answer
69 views
Using import vs require with Node and Sequelize
I'm using type module/import syntax for the rest of my project, but the Sequelize CLI generates files with require syntax. How should I handle this? I'm already having trouble with not being able to ...
1 vote
2 answers
92 views
PHP $_SERVER['DOCUMENT_ROOT'] removed a slash
I read other posts about $_SERVER['DOCUMENT_ROOT'] (like Where to set PHP $_SERVER['DOCUMENT_ROOT'] Trailing Slash?) but what happened to me is that all the pages in my website basically lost the ...
0 votes
1 answer
1k views
plugin externalize-deps - This package is ESM only but it was tried to load by `require`
I am installing a plugin in Vite, but I run into an error message stating that the package only supports ESM, not CJS. package.json { "devDependencies": { "example-package": &...
1 vote
1 answer
51 views
Use template functions inside template
I want to implement the following for more than one (i.e. many) functions (function1(), function2(), ...etc.). Currently I have it separately as follows: template <typename T> concept iterator_1 ...
0 votes
1 answer
69 views
JS function works only when hard refreshing page
I'm sure this has something to do with the timing of things loading, but I can't figure it out. I'm using Oracle's Jet charting libraries and trying to convert the y-axis to a percent When I run this ...
5 votes
1 answer
162 views
Why can't C++ tell return_void and return_value are mutually exclusive?
I am trying to define my own coroutine promise type, and I have the following declarations: void return_void() requires std::same_as<T, void> {} template<class X> void return_value(X&&...
0 votes
1 answer
35 views
How can I set require() to dynamically update with an image path in React? [duplicate]
I have an image on my About page of a react app which i'd like the image to change to a new image every 5secs. I have set up my hooks and my aboutImg state is initially set to require('./img/rope.jpg')...
0 votes
1 answer
171 views
How to use --exec option in nestjs command
I'm trying to use the --exec option to run a command before the nestjs server start (--require). I want to modify the start:dev script in my package.json But I can not make it work, always got an ...
2 votes
2 answers
144 views
How to "require" a LUA script within a Spoon-package?
We have base LUA file ~/.hammerspoon/init.lua which can load a spoon package: hs.loadSpoon("Foo") Now we have our package file init.lua by path: ~/.hammerspoon/Spoons/Foo.Spoon/init.lua It ...
0 votes
1 answer
118 views
Fix ruby project inconsistent files using zeitwerk
For a large (non-Rails) ruby project with thousands files not following naming convention for class, module and constants that uses a lot require and require_relative and potential circular dependency,...
0 votes
0 answers
38 views
Vuejs access to file outside of the application
I have several files on my server located at /var/www/files/ My vuejs is in ~/Dev/app I did : let file = require('/var/www/files/myfile.jpg') then npm run build my app. But I have this error 🫣 : ...
1 vote
1 answer
143 views
Issue with hardhat test
I am learning solidity and here I encountered some test error. I was running script test using hardhat npx hardhat test. This error was produced error Error [ERR_REQUIRE_ESM]: require() of ES Module C:...