Category: Nodejs

0

How to publish a package on npm

So, you are ready to publish a package to npm but are not sure how to go about it? This blog post aims to provide one approach to publishing packages onto npm. So, read...

0

Dynamic module loading with require

Let’s say we have ./darwin.js for mac, ./win32.js for Windows in the current working directory. And we want to require one of them in ./index.js based on which platform the file is being ran....

0

set the default node version using nvm

If you are using nvm for managing nodejs(which is the recommended way), you can easily ensure that the same version of nodejs is available in all terminal windows or tabs. Below are some helpful...

0

exports is not defined

This is very common error when your project has ES6 modules as well as require.js module systems. Here, I will show you few examples on how to require ES6 modules inside an AMD module....

0

Use node in es6 syntax with babel transpiling

Install the following packages : npm i –save babel-register npm i –save babel-preset-latest Create an entry point. For example, index.js It transpiles your app at runtime by hooking into all require calls, and lets...

0

nodejs: generate uuid / guid

node-uuid provide a simpler and reliable way to create unique id. It is rigorous implementation of RFC4122 (v1 and v4) UUIDs. // npm i node-uuid var uuid = require(‘node-uuid’); // Generate a v1 (time-based)...

0

Resolved – sudo npm command not found

Recently when I was trying to run my application on an ubuntu virtual server, I kept getting the error npm command not found even though I had installed nvm an node. Based on my...

Show Buttons
Hide Buttons