Publish development version of NPM package

NPM package version must meet requirements of semver

A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative integers, and MUST NOT contain leading zeroes. X is the major version, Y is the minor version, and Z is the patch version. Each element MUST increase numerically. For instance: 1.9.0 -> 1.10.0 -> 1.11.0.

So using dev as a version number is not allowed.

Also it is not recommended to publish any code which is in development state. If you want to test your module within different module you can include that module using relative path or using git remote URL.

Example:

Let's say that the module which you are developing is called foo and you would like to test it in module bar, script file bar/index.js. Let's assume both module directories are in the same parent directory. Instead of publishing unfinished module foo to npm and install it in module bar, you can do as follows:

var foo = require('../foo')

As suggested by Ionicã Bizãu (comments below), you can also use npm install with git remote URL e.g.

npm install <git remote url>

NPM install documentation provides more details (option g) on that installation method.

Alternatively you can use approach proposed in this post: Locally test your npm modules without publishing them to npmjs.org.

EDIT

There is another alternative solution which require npm link command:

  • Execute npm link command inside your developed module. That will create globally-installed symbolic link from prefix/package-name to the current folder
  • Another step is to execute npm link package-name (where package-name is a name of your developed package) in some other location (other module / application which you use to test the developed module). That will create a symlink from the local node_modules folder to the global symlink (which was created in the first step).

Note that you may need to run the first command as a privileged user (usually sudo helps) in some operating systems.

With symlinks in place you will be able to add changes to your developed module and see their results instantly in other linked modules.

I hope that will help.


You can upload prerelease tags to npm. These tags will not be matched by normal semver range semantics, but will allow you to both use and upload development versions. An example would be 1.3.5-alpha.3. If you're uploading something that has no version yet, then a reasonable use would be something like 0.0.1-alpha.1.

Tags:

Node.Js

Npm