我在meteor项目中使用了所有角度库版本@2.0.0-rc.4
的package.json
但后来我只是用2.0.1
替换它们
所以我的package.json看起来像这样:
{
"name": "angular2-meteor-base",
"private": true,
"scripts": {
"start": "meteor run",
"test": "meteor test --driver-package practicalmeteor:mocha",
"test:ci": "meteor test --once --driver-package dispatch:mocha-phantomjs"
},
"devDependencies": {
"chai": "3.5.0",
"chai-spies": "0.7.1"
},
"dependencies": {
"@angular/common": "2.0.1",
"@angular/compiler": "2.0.1",
"@angular/core": "2.0.1",
"@angular/forms": "0.2.0",
"@angular/platform-browser": "2.0.1",
"@angular/platform-browser-dynamic": "2.0.1",
"@angular/router": "3.0.0-alpha.8",
"angular2-meteor": "0.6.2",
"angular2-meteor-auto-bootstrap": "0.6.0",
"angular2-meteor-polyfills": "0.1.1",
"angular2-meteor-tests-polyfills": "0.0.2",
"es6-shim": "0.35.1",
"meteor-node-stubs": "0.2.3",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "0.6.12"
}
}
删除meteor npm install
后运行npm install
或node_modules
控制台输出是:
+-- @angular/common@2.0.0-rc.4
+-- @angular/compiler@2.0.0-rc.4
+-- @angular/core@2.0.0-rc.4
+-- @angular/forms@0.2.0
+-- @angular/platform-browser@2.0.0-rc.4
+-- @angular/platform-browser-dynamic@2.0.0-rc.4
+-- @angular/router@3.0.0-alpha.8
+-- angular2-meteor@0.6.2
+-- angular2-meteor-auto-bootstrap@0.6.0
+-- angular2-meteor-polyfills@0.1.1
+-- angular2-meteor-tests-polyfills@0.0.2
+-- bootstrap@4.0.0-alpha.2
+-- chai@3.5.0
| +-- assertion-error@1.0.2
| +-- deep-eql@0.1.3
| | `-- type-detect@0.1.1
| `-- type-detect@1.0.0
+-- chai-spies@0.7.1
+-- es6-shim@0.35.1
+-- meteor-node-stubs@0.2.3
| +-- assert@1.3.0
| +-- browserify-zlib@0.1.4
| | `-- pako@0.2.8
| +-- buffer@4.5.1
| | +-- base64-js@1.1.2
| | +-- ieee754@1.1.6
| | `-- isarray@1.0.0
| +-- console-browserify@1.1.0
| | `-- date-now@0.1.4
| +-- constants-browserify@1.0.0
| +-- crypto-browserify@3.11.0
| | +-- browserify-cipher@1.0.0
| | | +-- browserify-aes@1.0.6
| | | | +-- buffer-xor@1.0.3
| | | | `-- cipher-base@1.0.2
| | | +-- browserify-des@1.0.0
| | | | +-- cipher-base@1.0.2
| | | | `-- des.js@1.0.0
| | | | `-- minimalistic-assert@1.0.0
| | | `-- evp_bytestokey@1.0.0
| | +-- browserify-sign@4.0.0
| | | +-- bn.js@4.11.1
| | | +-- browserify-rsa@4.0.1
| | | +-- elliptic@6.2.3
| | | | +-- brorand@1.0.5
| | | | `-- hash.js@1.0.3
| | | `-- parse-asn1@5.0.0
| | | +-- asn1.js@4.5.2
| | | | `-- minimalistic-assert@1.0.0
| | | +-- browserify-aes@1.0.6
| | | | +-- buffer-xor@1.0.3
| | | | `-- cipher-base@1.0.2
| | | `-- evp_bytestokey@1.0.0
| | +-- create-ecdh@4.0.0
| | | +-- bn.js@4.11.1
| | | `-- elliptic@6.2.3
| | | +-- brorand@1.0.5
| | | `-- hash.js@1.0.3
| | +-- create-hash@1.1.2
| | | +-- cipher-base@1.0.2
| | | +-- ripemd160@1.0.1
| | | `-- sha.js@2.4.5
| | +-- create-hmac@1.1.4
| | +-- diffie-hellman@5.0.2
| | | +-- bn.js@4.11.1
| | | `-- miller-rabin@4.0.0
| | | `-- brorand@1.0.5
| | +-- inherits@2.0.1
| | +-- pbkdf2@3.0.4
| | +-- public-encrypt@4.0.0
| | | +-- bn.js@4.11.1
| | | +-- browserify-rsa@4.0.1
| | | `-- parse-asn1@5.0.0
| | | +-- asn1.js@4.5.2
| | | | `-- minimalistic-assert@1.0.0
| | | +-- browserify-aes@1.0.6
| | | | +-- buffer-xor@1.0.3
| | | | `-- cipher-base@1.0.2
| | | `-- evp_bytestokey@1.0.0
| | `-- randombytes@2.0.3
| +-- domain-browser@1.1.7
| +-- events@1.1.0
| +-- http-browserify@1.7.0
| | +-- Base64@0.2.1
| | `-- inherits@2.0.1
| +-- https-browserify@0.0.1
| +-- os-browserify@0.2.1
| +-- path-browserify@0.0.0
| +-- process@0.11.2
| +-- punycode@1.4.1
| +-- querystring-es3@0.2.1
| +-- readable-stream@2.0.6
| | +-- core-util-is@1.0.2
| | +-- inherits@2.0.1
| | +-- isarray@1.0.0
| | +-- process-nextick-args@1.0.6
| | `-- util-deprecate@1.0.2
| +-- stream-browserify@2.0.1
| | `-- inherits@2.0.1
| +-- string_decoder@0.10.31
| +-- timers-browserify@1.4.2
| +-- tty-browserify@0.0.0
| +-- url@0.11.0
| | +-- punycode@1.3.2
| | `-- querystring@0.2.0
| +-- util@0.10.3
| | `-- inherits@2.0.1
| `-- vm-browserify@0.0.4
| `-- indexof@0.0.1
+-- reflect-metadata@0.1.3
+-- rxjs@5.0.0-beta.6
+-- tether@1.3.7
`-- zone.js@0.6.12
那么为什么会发生这种情况,我该怎么做才能安装正确版本的库?
答案 0 :(得分:1)
在新目录中尝试相同的package.json文件,看看是否有相同的结果。
我在一个空目录中使用了你的package.json并运行了npm i
,结果如下:
angular2-meteor-base@ /Volumes/HD2/Downloads/tmp
├── @angular/common@2.0.1
├── @angular/compiler@2.0.1
├── @angular/core@2.0.1
├── @angular/forms@0.2.0
├── @angular/platform-browser@2.0.1
├── @angular/platform-browser-dynamic@2.0.1
├── @angular/router@3.0.0-alpha.8
├── angular2-meteor@0.6.2
├── angular2-meteor-auto-bootstrap@0.6.0
├── angular2-meteor-polyfills@0.1.1
├── angular2-meteor-tests-polyfills@0.0.2
├─┬ chai@3.5.0
│ ├── assertion-error@1.0.2
│ ├─┬ deep-eql@0.1.3
│ │ └── type-detect@0.1.1
│ └── type-detect@1.0.0
├── chai-spies@0.7.1
├── es6-shim@0.35.1
├─┬ meteor-node-stubs@0.2.3
│ ├── assert@1.3.0
│ ├─┬ browserify-zlib@0.1.4
│ │ └── pako@0.2.8
│ ├─┬ buffer@4.5.1
│ │ ├── base64-js@1.1.2
│ │ ├── ieee754@1.1.6
│ │ └── isarray@1.0.0
│ ├─┬ console-browserify@1.1.0
│ │ └── date-now@0.1.4
│ ├── constants-browserify@1.0.0
│ ├─┬ crypto-browserify@3.11.0
│ │ ├─┬ browserify-cipher@1.0.0
│ │ │ ├─┬ browserify-aes@1.0.6
│ │ │ │ ├── buffer-xor@1.0.3
│ │ │ │ └── cipher-base@1.0.2
│ │ │ ├─┬ browserify-des@1.0.0
│ │ │ │ ├── cipher-base@1.0.2
│ │ │ │ └─┬ des.js@1.0.0
│ │ │ │ └── minimalistic-assert@1.0.0
│ │ │ └── evp_bytestokey@1.0.0
│ │ ├─┬ browserify-sign@4.0.0
│ │ │ ├── bn.js@4.11.1
│ │ │ ├── browserify-rsa@4.0.1
│ │ │ ├─┬ elliptic@6.2.3
│ │ │ │ ├── brorand@1.0.5
│ │ │ │ └── hash.js@1.0.3
│ │ │ └─┬ parse-asn1@5.0.0
│ │ │ ├─┬ asn1.js@4.5.2
│ │ │ │ └── minimalistic-assert@1.0.0
│ │ │ ├─┬ browserify-aes@1.0.6
│ │ │ │ ├── buffer-xor@1.0.3
│ │ │ │ └── cipher-base@1.0.2
│ │ │ └── evp_bytestokey@1.0.0
│ │ ├─┬ create-ecdh@4.0.0
│ │ │ ├── bn.js@4.11.1
│ │ │ └─┬ elliptic@6.2.3
│ │ │ ├── brorand@1.0.5
│ │ │ └── hash.js@1.0.3
│ │ ├─┬ create-hash@1.1.2
│ │ │ ├── cipher-base@1.0.2
│ │ │ ├── ripemd160@1.0.1
│ │ │ └── sha.js@2.4.5
│ │ ├── create-hmac@1.1.4
│ │ ├─┬ diffie-hellman@5.0.2
│ │ │ ├── bn.js@4.11.1
│ │ │ └─┬ miller-rabin@4.0.0
│ │ │ └── brorand@1.0.5
│ │ ├── inherits@2.0.1
│ │ ├── pbkdf2@3.0.4
│ │ ├─┬ public-encrypt@4.0.0
│ │ │ ├── bn.js@4.11.1
│ │ │ ├── browserify-rsa@4.0.1
│ │ │ └─┬ parse-asn1@5.0.0
│ │ │ ├─┬ asn1.js@4.5.2
│ │ │ │ └── minimalistic-assert@1.0.0
│ │ │ ├─┬ browserify-aes@1.0.6
│ │ │ │ ├── buffer-xor@1.0.3
│ │ │ │ └── cipher-base@1.0.2
│ │ │ └── evp_bytestokey@1.0.0
│ │ └── randombytes@2.0.3
│ ├── domain-browser@1.1.7
│ ├── events@1.1.0
│ ├─┬ http-browserify@1.7.0
│ │ ├── Base64@0.2.1
│ │ └── inherits@2.0.1
│ ├── https-browserify@0.0.1
│ ├── os-browserify@0.2.1
│ ├── path-browserify@0.0.0
│ ├── process@0.11.2
│ ├── punycode@1.4.1
│ ├── querystring-es3@0.2.1
│ ├─┬ readable-stream@2.0.6
│ │ ├── core-util-is@1.0.2
│ │ ├── inherits@2.0.1
│ │ ├── isarray@1.0.0
│ │ ├── process-nextick-args@1.0.6
│ │ └── util-deprecate@1.0.2
│ ├─┬ stream-browserify@2.0.1
│ │ └── inherits@2.0.1
│ ├── string_decoder@0.10.31
│ ├── timers-browserify@1.4.2
│ ├── tty-browserify@0.0.0
│ ├─┬ url@0.11.0
│ │ ├── punycode@1.3.2
│ │ └── querystring@0.2.0
│ ├─┬ util@0.10.3
│ │ └── inherits@2.0.1
│ └─┬ vm-browserify@0.0.4
│ └── indexof@0.0.1
├── reflect-metadata@0.1.3
├── UNMET PEER DEPENDENCY rxjs@5.0.0-beta.6
└── UNMET PEER DEPENDENCY zone.js@0.6.12
npm WARN @angular/core@2.0.1 requires a peer of rxjs@5.0.0-beta.12 but none was installed.
npm WARN @angular/core@2.0.1 requires a peer of zone.js@^0.6.21 but none was installed.
答案 1 :(得分:0)
我发现依赖关系实际上是从npm-shrinkwrap.json
解决的,它在控制台输出中有依赖版本。