所以基本上这是package.json的json文件,我用npm install :(对于github上的angularfire-seed项目,如果有人想知道的话)
{
"name": "angularfire-seed",
"description": "A starter project for Angular + Firebase with AngularFire",
"version": "1.0.0",
"homepage": "https://github.com/firebase/angularfire-seed",
"repository": "https://github.com/angular/angular-seed",
"private": true,
"license": "MIT",
"devDependencies": {
"karma": "~0.10",
"protractor": "~0.20.1",
"http-server": "^0.6.1",
"bower": "^1.3.1",
"shelljs": "^0.2.6"
},
"scripts": {
"postinstall": "bower install",
"prestart": "npm install",
"start": "http-server -a localhost -p 8000",
"pretest": "npm install",
"test": "karma start karma.conf.js",
"test-single-run": "karma start karma.conf.js --single-run",
"preupdate-webdriver": "npm install",
"update-webdriver": "webdriver-manager update",
"preprotractor": "npm run update-webdriver",
"protractor": "protractor e2e-tests/protractor-conf.js",
"update-index-async": "node -e \"require('shelljs/global'); sed('-i', /\\/\\/@@NG_LOADER_START@@[\\s\\S]*\\/\\/@@NG_LOADER_END@@/, '//@@NG_LOADER_START@@\\n' + cat('app/bower_components/angular-loader/angular-loader.min.js') + '\\n//@@NG_LOADER_END@@', 'app/index-async.html');\""
}
}
但是我一直收到来自NPM的错误消息,其中说它"未能解析json"那个" package.json必须是实际的JSON,而不仅仅是Javascript" (错误代码EJSONPARSE)但jsonlint.com说它是一种有效的JSON格式。到底是怎么回事?以及如何才能真正成功地运行" npm install"从命令行。
答案 0 :(得分:3)
$ npm install semver
$ node
> var semver = require('semver');
> semver.valid("~0.10"); // returns null
null
根据这个:https://docs.npmjs.com/files/package.json,您的所有版本号都应符合node-semver。
Git允许数字版本号。而npm没有。
所以在你的情况下,
依赖版本号需要采用package.json中的major.minor.patch
格式。