node

Fixing “error: cannot find module semver” error in Node.js

Fixing “error: cannot find module semver” error in Node.js

  • October 19, 2023

When installing a package using npm, you might encounter the “error: cannot find module semver” error. The error is caused because of a corrupted package-lock.json or yarn.lock. The most common reason for this is a change in the node version. Fixing “error: cannot find module semver” The fix is a...

Fix “Error:0308010C:digital envelope routines::unsupportedFixing” in Node.js

Fix “Error:0308010C:digital envelope routines::unsupportedFixing” in Node.js

  • October 17, 2023

Node 17 introduced OpenSSL v3.0, which brought in some breaking changes, and the “Error: error:0308010C:digital envelope routines::unsupported” is a result of one such change. It can be solved by passing in a “–openssl-legacy-provider” flag when running the application. Setting the NODE_OPTIONS environment variable We can set the environment variable that...

How to prevent npm install for unsupported Node.js versions

How to prevent npm install for unsupported Node.js versions

  • March 17, 2022

npm configurations allow us to do quite a lot of nifty things. One of them is to allow the project to set the Node.js version that needs to be used in order to run the project. This also provides us with the functionality to prevent npm install for unsupported Node.js...

Specifying a node version in Repl.it

Specifying a node version in Repl.it

  • September 13, 2021

I was recently trying to use a later version of Node on Repl.it. I wanted to use a package that supported ES Modules, and the default version did not have support for it. So I wanted to use the latest node version in Repl.it. And found that there was no...

How to import/export ES6 modules in Node

How to import/export ES6 modules in Node

  • June 19, 2018

If you have been following the javascript ecosystem for a while, you already know that even though ES6 modules are a thing, you still cannot import/export ES6 modules in node.js as of today. Node 10 experimental flag for importing/exporting ES6 modules in Node Though Node 10 has added an experimental...

Using Babel to import/export ES2015 modules in Node.js

Using Babel to import/export ES2015 modules in Node.js

  • August 15, 2017

Using “require” statements (commonJS syntax) in your server side code while writing “import” and “export” statements (ES2015 syntax) for your front end makes writing javascript a bit weird. The reason for not having import and export statements for modules is that node parses modules a bit differently than how they...