编辑:见底部
我查了大量有关重复标识符问题的文章,但没有找到任何可以帮我解决这个问题的内容。我有以下package.json:
"dependencies": {
"@angular/common": "2.3.0",
"@angular/compiler": "2.3.0",
"@angular/core": "2.3.0",
"@angular/forms": "2.3.0",
"@angular/http": "2.3.0",
"@angular/material": "^2.0.0-alpha.11-3",
"@angular/platform-browser": "2.3.0",
"@angular/platform-browser-dynamic": "2.3.0",
"@angular/router": "3.3.0",
"angular2-jwt": "^0.1.26",
"angular2-modal": "^2.0.2",
"bootstrap": "^3.3.7",
"fs": "0.0.1-security",
"gulp": "^3.9.1",
"jquery": "^3.1.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-rc.4",
"stripe": "^4.15.0",
"web-animations-js": "^2.2.2",
"zone.js": "^0.7.2"
},
"devDependencies": {
"@angularclass/hmr": "^1.0.1",
"@angularclass/hmr-loader": "^3.0.2",
"@types/es6-shim": "^0.31.32",
"@types/jasmine": "^2.2.29",
"@types/node": "^6.0.38",
"@types/selenium-webdriver": "2.53.33",
"angular2-router-loader": "^0.3.4",
"angular2-template-loader": "^0.6.0",
"autoprefixer": "^6.3.2",
"awesome-typescript-loader": "^2.2.4",
"codelyzer": "1.0.0-beta.3",
"copy-webpack-plugin": "^4.0.0",
"css-loader": "^0.25.0",
"exports-loader": "^0.6.3",
"extract-text-webpack-plugin": "^2.0.0-beta.4",
"file-loader": "^0.9.0",
"html-loader": "^0.4.0",
"html-webpack-plugin": "^2.8.1",
"imports-loader": "^0.7.0",
"istanbul-instrumenter-loader": "^0.2.0",
"jasmine-core": "^2.3.4",
"jasmine-spec-reporter": "^2.4.0",
"json-loader": "^0.5.3",
"karma": "1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.0.0",
"karma-jasmine": "^1.0.2",
"karma-mocha-reporter": "^2.0.3",
"karma-remap-istanbul": "0.2.1",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "1.8.0",
"node-sass": "^3.4.2",
"null-loader": "0.1.1",
"postcss-loader": "^1.1.0",
"protractor": "^4.0.10",
"raw-loader": "0.5.1",
"remap-istanbul": "^0.6.4",
"resolve-url": "^0.2.1",
"resolve-url-loader": "^1.6.1",
"rimraf": "^2.5.1",
"sass-loader": "^4.0.2",
"shelljs": "^0.7.0",
"style-loader": "^0.13.1",
"ts-helpers": "^1.1.1",
"tslint": "^3.4.0",
"tslint-loader": "^2.1.0",
"typedoc": "^0.5.1",
"typescript": "2.0.10",
"url-loader": "^0.5.7",
"webpack": "^2.1.0-beta.25",
"webpack-dashboard": "^0.2.0",
"webpack-dev-server": "2.1.0-beta.9"
}
}
然后在我的tsconfig.json
里面
{
"compilerOptions": {
"target": "es6",
"lib": ["dom", "es5"],
"typeRoots": [
"./node_modules/@types"
],
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"noEmitHelpers": true,
"noImplicitAny": false
},
"compileOnSave": false,
"buildOnSave": false,
"awesomeTypescriptLoaderOptions": {
"forkChecker": true,
"useWebpackText": true
},
"exclude": [
"node_modules",
"**/*.spec.ts",
"dist"
]
}
但是每当我尝试运行webpack构建时,我都会得到:
node_modules/@types/lodash/index.d.ts:244:12 Duplicate identifier '_'
所以看起来我的几个套餐互相干扰了?有谁知道哪些?谢谢你的帮助
编辑我发现构建冲突的原因,似乎我有
node_modules/lodash
同时我有node_modules/@types/lodash
,现在如何找到安装类型lodash的类型包?
答案 0 :(得分:10)
将"@types/lodash": "ts2.0",
添加到package.json为我工作。
https://github.com/driftyco/ionic-app-scripts/issues/700
希望它有所帮助。 :)