之前我做过以下事情:
MacBook-Pro:bb-ns-ng-dr ishandutta2007$ npm uninstall -g semver
MacBook-Pro:bb-ns-ng-dr ishandutta2007$ npm uninstall semver
MacBook-Pro:bb-ns-ng-dr ishandutta2007$ rm -rf platforms/
MacBook-Pro:bb-ns-ng-dr ishandutta2007$ rm -rf node_modules/
MacBook-Pro:bb-ns-ng-dr ishandutta2007$ tns build android --clean
我不断获得semver重复资源错误,即使semver既不是我定义的任何节点模块也不是任何第三级依赖项。撇开Duplicate资源的共鸣我更加好奇它是如何首先出现的。
无法合并源集文件夹: [应用程序/ node_modules / semver / semver.min.js] /Users/ishandutta2007/Documents/Projects/bb-ns-ng-dr/platforms/android/src/main/assets/app/node_modules/semver/semver.min.js [应用程序/ node_modules / semver / semver.min.js] /Users/ishandutta2007/Documents/Projects/bb-ns-ng-dr/platforms/android/src/main/assets/app/node_modules/semver/semver.min.js.gz: 错误:重复资源[app / node_modules / semver / semver.browser.js] /Users/ishandutta2007/Documents/Projects/bb-ns-ng-dr/platforms/android/src/main/assets/app/node_modules/semver/semver.browser.js [应用程序/ node_modules / semver / semver.browser.js] /Users/ishandutta2007/Documents/Projects/bb-ns-ng-dr/platforms/android/src/main/assets/app/node_modules/semver/semver.browser.js.gz: 错误:资源重复
以下是我的节点模块包树的样子
MacBook-Pro:bb-ns-ng-dr ishandutta2007$ npm ls
/Users/ishandutta2007/Documents/Projects/bb-ns-ng-dr
├── @angular/animations@4.1.3
├── @angular/common@4.1.3
├── @angular/compiler@4.1.3
├── UNMET PEER DEPENDENCY @angular/core@4.1.3
├── @angular/forms@4.1.3
├── @angular/http@4.1.3
├── @angular/platform-browser@4.1.3
├── @angular/platform-browser-dynamic@4.1.3
├── @angular/router@4.1.3
├── @ngrx/core@1.2.0
├── @ngrx/effects@2.0.2
├── @ngrx/store@2.2.1
├── @ngrx/store-devtools@3.2.4
├── @types/gapi@0.0.30
├── @types/gapi.auth2@0.0.34
├── @types/gapi.youtube@3.0.31
├── @types/jasmine@2.5.38
├── @types/youtube@0.0.28
├─┬ babel-traverse@6.24.1
│ ├─┬ babel-code-frame@6.22.0
│ │ ├─┬ chalk@1.1.3
│ │ │ ├── ansi-styles@2.2.1
│ │ │ ├── escape-string-regexp@1.0.5
│ │ │ ├─┬ has-ansi@2.0.0
│ │ │ │ └── ansi-regex@2.1.1
│ │ │ ├── strip-ansi@3.0.1
│ │ │ └── supports-color@2.0.0
│ │ └── js-tokens@3.0.1
│ ├── babel-messages@6.23.0
│ ├─┬ babel-runtime@6.23.0
│ │ ├── core-js@2.4.1
│ │ └── regenerator-runtime@0.10.5
│ ├─┬ debug@2.6.8
│ │ └── ms@2.0.0
│ ├── globals@9.17.0
│ ├─┬ invariant@2.2.2
│ │ └── loose-envify@1.3.1
│ └── lodash@4.17.4
├─┬ babel-types@6.24.1
│ ├── esutils@2.0.2
│ └── to-fast-properties@1.0.3
├── babylon@6.17.1
├── lazy@1.0.11
├─┬ nativescript-angular@3.0.0
│ └── nativescript-intl@3.0.0
├─┬ nativescript-dev-typescript@0.4.5
│ └─┬ nativescript-hook@0.2.1
│ ├─┬ glob@6.0.4
│ │ ├─┬ inflight@1.0.6
│ │ │ └── wrappy@1.0.2
│ │ ├── inherits@2.0.3
│ │ ├─┬ minimatch@3.0.4
│ │ │ └─┬ brace-expansion@1.1.7
│ │ │ ├── balanced-match@0.4.2
│ │ │ └── concat-map@0.0.1
│ │ ├── once@1.4.0
│ │ └── path-is-absolute@1.0.1
│ └─┬ mkdirp@0.5.1
│ └── minimist@0.0.8
├── nativescript-exoplayer@3.0.7
├── nativescript-localstorage@1.1.2
├── nativescript-telerik-ui@2.0.1
├── nativescript-theme-core@1.0.4
├── ngrx-action-creator-factory@0.0.1
├── ngrx-store-localstorage@0.1.5
├── reflect-metadata@0.1.10
├─┬ rxjs@5.3.3
│ └── symbol-observable@1.0.4
├─┬ tns-core-modules@3.0.1
│ └── tns-core-modules-widgets@3.0.1
├── typescript@2.2.2
└── zone.js@0.8.11
npm ERR! peer dep missing: @angular/core@^2.0.0, required by @ngrx/effects@2.0.2
npm ERR! peer dep missing: @angular/core@^2.0.0, required by @ngrx/store@2.2.1
npm ERR! peer dep missing: @angular/core@^2.0.0-rc.5, required by ngrx-store-localstorage@0.1.5
答案 0 :(得分:1)
npm
取决于semver
,因此您似乎不太可能完全摆脱全局变量。 According to npm有超过4,000个包依赖于它。
您可能希望将问题集中在您遇到的问题上,而不是询问它的来源。