汇总 - 冲突的命名空间
Posted
技术标签:
【中文标题】汇总 - 冲突的命名空间【英文标题】:Rollup - conflicting namespaces 【发布时间】:2017-04-07 14:41:27 【问题描述】:我目前正在构建一个 Ionic 2-RC3 应用程序。但是自从我升级到 RC-1 后,我得到了以下错误:(不确定它们是否保持不变,但你明白了)。
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports 'TextAst' from
both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports 'BoundTextAst'
from both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports 'AttrAst' from
both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports
'BoundElementPropertyAst' from both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports
'BoundEventAst' from both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports 'ReferenceAst'
from both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports 'VariableAst'
from both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports 'ElementAst'
from both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports
'EmbeddedTemplateAst' from both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports
'BoundDirectivePropertyAst' from both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports 'DirectiveAst'
from both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports 'ProviderAst'
from both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports
'ProviderAstType' from both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports 'NgContentAst'
from both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports
'PropertyBindingType' from both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17] rollup: Conflicting namespaces:
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports
'templateVisitAll' from both
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
(will be ignored) and
C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
package.json
"name": "ionic2-boilerplate",
"author": "Quintor",
"version": "0.2.0",
"keywords": [
"ionic2",
"angular2",
"rollup",
"typescript",
"karma"
],
"engines":
"node": ">= 6.6.0",
"npm": ">= 3"
,
"scripts":
"dev": "bnr dev",
"build": "bnr build",
"test": "bnr test",
"pree2e": "cd www && python -m SimpleHTTPServer 8090 >> ../python_serve.log 2>&1 &",
"e2e": "protractor config/protractor.conf.js",
"pree2e:interactive": "npm run pree2e",
"e2e:interactive": "protractor config/protractor.conf.js --elementExplorer",
"watch": "ionic-app-scripts watch",
"serve:before": "watch",
"emulate:before": "build",
"deploy:before": "build",
"build:before": "build",
"run:before": "build --dev",
"ios:dev": "bnr ios:dev",
"ios:release": "bnr ios:release",
"android:dev": "bnr android:dev",
"android:release": "bnr android:release",
"commit": "git-cz",
"release": "standard-version --no-verify",
"push": "git push --follow-tags origin master",
"lint": "tslint \"src/**/*.ts\" --exclude=src/**/*.d.ts",
"scss-lint": "scss-lint",
"docs": "typedoc --options typedoc.json --exclude '**/*.spec.ts' ./src/",
"outdated": "npm outdated --depth 0",
"postinstall": "webdriver-manager update --chrome"
,
"betterScripts":
"dev":
"command": "ionic serve",
"env":
"NODE_ENV": "development",
"PLATFORM": "web"
,
"build":
"command": "ionic-app-scripts build",
"env":
"NODE_ENV": "production",
"PLATFORM": "web"
,
"test":
"command": "karma start ./config/karma.conf.js",
"env":
"NODE_ENV": "test"
,
"ios:dev":
"command": "ionic run ios --livereload",
"env":
"NODE_ENV": "development",
"PLATFORM": "ios"
,
"ios:release":
"command": "npm run build && ionic build ios",
"env":
"NODE_ENV": "production",
"PLATFORM": "ios"
,
"android:dev":
"command": "ionic run android --livereload",
"env":
"NODE_ENV": "development",
"PLATFORM": "android"
,
"android:release":
"command": "npm run build && ionic build android",
"env":
"NODE_ENV": "production",
"PLATFORM": "android"
,
"dependencies":
"@angular/common": "2.1.1",
"@angular/compiler": "2.1.1",
"@angular/compiler-cli": "2.1.1",
"@angular/core": "2.1.1",
"@angular/forms": "2.1.1",
"@angular/http": "2.1.1",
"@angular/platform-browser": "2.1.1",
"@angular/platform-browser-dynamic": "2.1.1",
"@angular/platform-server": "2.1.1",
"@ionic/storage": "1.1.6",
"ionic-angular": "2.0.0-rc.3",
"ionic-native": "2.2.3",
"ionicons": "3.0.0",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.26",
"lz-string": "^1.4.4",
"ng2-charts": "^1.4.1"
,
"devDependencies":
"@ionic/app-scripts": "0.0.46",
"@types/jasmine": "2.2.34",
"@types/lodash": "^4.14.36",
"better-npm-run": "0.0.11",
"codelyzer": "^1.0.0-beta.0",
"commitizen": "^2.8.6",
"cz-conventional-changelog": "^1.2.0",
"ghooks": "^1.3.2",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "^2.7.0",
"karma": "1.3.0",
"karma-chrome-launcher": "2.0.0",
"karma-coverage": "^1.1.1",
"karma-jasmine": "1.0.2",
"karma-phantomjs-launcher": "^1.0.2",
"karma-rollup-plugin": "^0.2.4",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.26",
"phantomjs-prebuilt": "^2.1.12",
"protractor": "^4.0.9",
"protractor-jasmine2-screenshot-reporter": "^0.3.2",
"rollup-plugin-alias": "^1.2.0",
"rollup-plugin-angular": "^0.4.2",
"rollup-plugin-buble": "^0.14.0",
"rollup-plugin-commonjs": "^5.0.4",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-replace": "^1.1.1",
"rollup-plugin-typescript": "^0.8.1",
"standard-version": "^2.2.1",
"ts-helpers": "^1.1.1",
"ts-node": "^1.3.0",
"typedoc": "^0.4.5",
"typescript": "^2.0.3",
"validate-commit-msg": "^2.8.0"
,
"config":
"commitizen":
"path": "./node_modules/cz-conventional-changelog"
,
"ionic_rollup": "./config/rollup.config.js"
,
"description": "ionic2-boilerplate: An Ionic project",
"cordovaPlugins": [
"cordova-plugin-device",
"cordova-plugin-console",
"cordova-plugin-whitelist",
"cordova-plugin-splashscreen",
"cordova-plugin-statusbar",
"ionic-plugin-keyboard",
"variables":
"SENDER_ID": "123456789 1337"
,
"locator": "phonegap-plugin-push",
"id": "phonegap-plugin-push"
],
"cordovaPlatforms": [],
"license": "MIT"
现在我的问题是,是什么线路导致了这种情况,为什么会发生这种情况?因为对我来说,我的package.json
中似乎没有重复值。
rm -rf node_modules && npm install
没有解决这个问题。
【问题讨论】:
这里是 ionic github.com/driftyco/ionic/blob/master/package.json 提供的更新后的 package.json 文件,尝试用这个替换你的 package.json 并给ionic build android
希望对你有帮助
如果它只是那么简单;) 已经用RC.2
和RC.3
尝试过,仍然是同样的错误。我能想到的只是我的其他依赖项中的 1 个需要与我需要的依赖项相同的依赖项,因此会创建重复的版本。我就是不知道是哪一个
【参考方案1】:
可能是 rollup.config.js 的问题
Default ionic rollup config
还可以查看Third party module exports here。
你可以:
打开 node_modules/@ionic/app-scripts/config/rollup.config.js 并将文件内容复制并粘贴到 scripts/rollup.config.js。
如果您有自定义设置,则需要进行一些返工。 希望对您有所帮助。
【讨论】:
我多次升级了ionic/app-scripts
,尝试了0.0.39
、0.0.45
、0.0.46
和0.0.47
的版本——>强迫我合并main.dev.ts
和main.prod.ts
。所以我基本上尝试了你的答案,但很难以上是关于汇总 - 冲突的命名空间的主要内容,如果未能解决你的问题,请参考以下文章