Ionică Bizău Ionică Bizău - 3 months ago 13
Node.js Question

Publish development version of NPM package

How can I publish development version of NPM package?

I tried to set

"dev"
value for
version
field in
package.json
but I got an error when publishing it:

$ npm publish
npm ERR! Error: Invalid version: "dev"
npm ERR! at Object.module.exports.fixVersionField (/usr/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js:180:13)
npm ERR! at /usr/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js:29:38
npm ERR! at Array.forEach (native)
npm ERR! at normalize (/usr/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js:28:15)
npm ERR! at final (/usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:310:33)
npm ERR! at then (/usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:124:33)
npm ERR! at /usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:299:40
npm ERR! at fs.js:266:14
npm ERR! at /usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:103:5
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/isaacs/npm/issues>

npm ERR! System Linux 3.11.0-15-generic
npm ERR! command "node" "/usr/bin/npm" "publish"
npm ERR! cwd /home/ionicabizau/package-name
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.23
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/ionicabizau/package-name/npm-debug.log
npm ERR! not ok code 0


Which are the closest alternatives?

Answer

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.

Comments