node.js - npm:为什么版本 "0.1"无效?

标签 node.js npm

我不得不将我的 npm 应用程序的版本从 0.1 更改为 0.0.1,以便 npm 不这样做。

$ npm install
npm ERR! install Couldn't read dependencies
npm ERR! Error: invalid version: 0.1
npm ERR!     at validVersion (/usr/local/Cellar/node/0.10.5/lib/node_modules/npm/node_modul
es/read-package-json/read-json.js:571:40)
npm ERR!     at final (/usr/local/Cellar/node/0.10.5/lib/node_modules/npm/node_modules/read
-package-json/read-json.js:323:23)
npm ERR!     at /usr/local/Cellar/node/0.10.5/lib/node_modules/npm/node_modules/read-packag
e-json/read-json.js:139:33
npm ERR!     at cb (/usr/local/Cellar/node/0.10.5/lib/node_modules/npm/node_modules/slide/l
ib/async-map.js:48:11)
npm ERR!     at /usr/local/Cellar/node/0.10.5/lib/node_modules/npm/node_modules/read-packag
e-json/read-json.js:301:48
npm ERR!     at fs.js:207:20
npm ERR!     at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Darwin 12.3.0
npm ERR! command "/usr/local/Cellar/node/0.10.5/bin/node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/lust/Documents/ply/dev-server
npm ERR! node -v v0.10.5
npm ERR! npm -v 1.2.18
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/lust/Documents/ply/dev-server/npm-debug.log
npm ERR! not ok code 0

为了完整起见,这里是工作 json

$ cat package.json
{
    "name": "ply",
    "description": "ply server for local dev testing deployments",
    "version": "0.0.1",
    "private": true,
    "dependencies": {
        "express": "3.x"
    }
} 

出错时的版本曾经是“0.1”。

这是某种需要 3 组版本号的 API/ABI 兼容性版本控制概念吗?为什么错误消息不是更友好w.r.t。这个?

最佳答案

是的,这是 semantic versioning 所必需的,这是 npm 包使用的版本控制方案。这里是 the snippet from npm help json :

Version must be parseable by node-semver, which is bundled with npm as a dependency. (npm install semver to use it yourself.)

Here's how npm's semver implementation deviates from what's on semver.org:

  • Versions can start with "v"
  • A numeric item separated from the main three-number version by a hyphen will be interpreted as a "build" number, and will increase the version. But, if the tag is not a number separated by a hyphen, then it's treated as a pre-release tag, and is less than the version without a tag. So, 0.1.2-7 > 0.1.2-7-beta > 0.1.2-6 > 0.1.2 > 0.1.2beta

关于node.js - npm:为什么版本 "0.1"无效?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16887993/

相关文章:

javascript - 将客户电子邮件传递给 strip 结帐

node.js - Mocha 在测试后没有退出

mysql - 如何在将记录异步放入运动流时确保顺序?

ios - ionic 错误 : Cannot find module 'dezalgo'

node.js - npm 命令 - 读取错误 : EISDIR: illegal operation on a directory,

css - 将 Bootstrap 与 Less/Grunt/NOde 结合使用

git - npm 从裸 git 文件 repo 安装

javascript - 在 Linux 中使用 node JS 连接 Redis

javascript - 要求功能不适用于 react 中的图像

node.js - 安装 Angular CLI 时收到错误警告