Back to categories

Category: "JavaScript"

Fix NPM No Such File Error on WSL2 Janne Kemppainen |

I was working on a Node.js project and decided to run it on top of Windows Subsystem for Linux but it just wouldn’t work. The npm command would fail with a “no such file or directory error” like this:

Use Inquirer.js to Create a Conversational CLI User Interface Janne Kemppainen |

Your CLI apps don’t have to be boring. Especially when there are plenty of possible configuration options, and the program is not going to be executed from a script, it might be better to provide a conversational user experience.

Make an NPM Package Executable with npx Janne Kemppainen |

You may have used the create-react-app package and thought that you’d like to make your own NPM package work in the same way with npx. It’s actually quite easy.

Import ES6 Modules in Node.js Janne Kemppainen |

With the ECMAScript modules definition we can use the import and export keywords to load and publish library code. However, if you try to use them in your Node.js project you might encounter the following error: