У меня проблемы с компиляцией проекта после обновления до angular 5. Проект не может быть скомпилирован, возможно, из-за неправильного набора текста. В проекте ранее использовались наборы, но я попытался установить их более современным способом, используя @types, но это тоже не исправило.
Ниже приведен текущий package.json:
{
"name": "my-app",
"version": "1.0.0",
"author": "geewhizbang",
"description": "Package for my-app",
"scripts": {
"start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"build": "npm run clean && tsc",
"test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
"posttest": "node_modules/.bin/remap-istanbul -i coverage/coverage-final.json -o coverage -t html",
"coverage": "http-server -c-1 -o -p 9875 ./coverage"
},
"license": "ISC",
"dependencies": {
"@angular/animations": "^5.2.10",
"@angular/common": "^5.2.10",
"@angular/compiler": "^5.2.10",
"@angular/compiler-cli": "^5.2.10",
"@angular/core": "^5.2.10",
"@angular/forms": "^5.2.10",
"@angular/http": "^5.2.10",
"@angular/platform-browser": "^5.2.10",
"@angular/platform-browser-dynamic": "^5.2.10",
"@angular/platform-server": "^5.2.10",
"@angular/router": "^5.2.10",
"@angular/upgrade": "2.3.0-rc.0",
"bootstrap": "^3.3.6",
"core-js": "^2.4.1",
"es6-shim": "^0.35.0",
"font-awesome": "^4.7.0",
"karma-coverage": "^1.1.1",
"reflect-metadata": "^0.1.8",
"remap-istanbul": "^0.8.4",
"rxjs": "5.0.0-rc.4",
"systemjs": "0.19.40",
"zone.js": "^0.7.2"
},
"devDependencies": {
"@types/angular": "^1.6.43",
"@types/angular-mocks": "^1.5.11",
"@types/angular-route": "^1.3.5",
"@types/angularlocalstorage": "^0.1.32",
"@types/express": "^4.11.1",
"@types/express-serve-static-core": "^4.11.1",
"@types/gulp": "^4.0.5",
"@types/jasmine": "^2.5.36",
"@types/jquery": "^3.3.1",
"@types/mime": "^2.0.0",
"@types/node": "^6.0.106",
"@types/q": "^1.5.0",
"@types/serve-static": "^1.13.1",
"babel-core": "^6.23.1",
"browserify": "^14.1.0",
"canonical-path": "0.0.2",
"compress": "^0.99.0",
"concurrently": "^3.1.0",
"del": "^2.2.2",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.1",
"gulp-imagemin": "^3.1.1",
"gulp-sourcemaps": "^2.4.1",
"gulp-typescript": "^3.1.5",
"gulp-uglify": "^2.0.1",
"http-server": "^0.9.0",
"jasmine-core": "~2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"lite-server": "^2.2.2",
"lodash": "^4.16.4",
"mangle": "^1.1.3",
"protractor": "~4.0.14",
"rimraf": "^2.5.4",
"systemjs-builder": "^0.16.3",
"tslint": "^3.15.1",
"typescript": "^2.8.3",
"uglifyjs": "^2.4.10"
},
"repository": {}
}
Приведенный выше файл был обновлен с оригинала с помощью npm install:
npm install @angular/common@latest @angular/compiler@latest @angular/compiler-cli@latest @angular/core@latest @angular/forms@latest @angular/http@latest @angular/platform-browser@latest @angular/platform-browser-dynamic@latest @angular/platform-server@latest @angular/router@latest @angular/animations@latest typescript@latest --save
Но теперь он не компилируется, потому что типы как-то напутаны.
Ниже приведен текущий файл tsconfig.json:
{
"compilerOptions": {
"target": "es6",
"module": "system",
"moduleResolution": "node",
"sourceMap": false, // make this false for minification
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"noStrictGenericChecks": true,
"outFile": "./app/app.min.js", // uncomment this line for minification
"typeRoots": [
"node_modules/@types"
]
},
"compileOnSave": true,
"exclude": [
"node_modules",
"typings",
//comment out these two lines for jasmine
"./app/**/*.spec.ts",
"./app/*.spec.ts"
]
}
Я пытался следовать тому, что предложил этот разработчик при преобразовании в @types:
https://georgedyrra.com/2017/06/04/migrating-from-typings-to-npm-types/