- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我尝试使用命令将我的应用程序从 Angular 2.4.10 升级到 4.0.0
"npm install @angular/common@next @angular/compiler@next @angular/compiler-cli@next @angular/core@next @angular/forms@next @angular/http@next @angular/platform-browser@next @angular/platform-browser-dynamic@next @angular/platform-server@next @angular/router@next @angular/animations@next --save".
虽然在“npm install”期间没有错误,但在“npm run build”期间收到以下错误。我按照更改日志中的指示将“lib”添加到 compilerOptions。
ERROR in [default]
File '/node_modules/bootstrap-loader/loader.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
ERROR in [default]
File '/node_modules/core-js/es6/index.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
ERROR in [default]
File '/node_modules/fullcalendar/dist/fullcalendar.min.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
ERROR in [default]
File '/node_modules/hammerjs/hammer.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
ERROR in [default]
File '/node_modules/jquery-ui/jquery-ui.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
ERROR in [default]
File '/node_modules/jquery/dist/jquery.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
ERROR in [default]
File '/node_modules/lodash/lodash.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
ERROR in [default]
File '/node_modules/ts-helpers/index.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
ERROR in [default]
File '/node_modules/zone.js/dist/zone.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
ERROR in [default] /node_modules/@angular/core/src/change_detection/differs/iterable_differs.d.ts:15:47
Cannot find name 'Iterable'.
ERROR in [default] /typings/browser/ambient/node/index.d.ts:426:10
Interface 'NodeBuffer' incorrectly extends interface 'Uint8Array'.
Types of property 'fill' are incompatible.
Type '(value: any, offset?: number, end?: number) => Buffer' is not assignable to type '(value: number, start?: number, end?: number) => this'.
Type 'Buffer' is not assignable to type 'this'.
“包.json”
"dependencies": {
"@angular/common": "4.0.0",
"@angular/compiler": "4.0.0",
"@angular/core": "4.0.0",
"@angular/forms": "4.0.0",
"@angular/http": "4.0.0",
"@angular/platform-browser": "4.0.0",
"@angular/platform-browser-dynamic": "4.0.0",
"@angular/platform-server": "4.0.0",
"@angular/router": "4.0.0",
"@angular/router-deprecated": "2.0.0-rc.2",
"angular2-toaster": "2.0.0",
"core-js": "^2.4.1",
"css-loader": "0.23.1",
"fullcalendar": "^2.7.1",
"hammerjs": "^2.0.8",
"intl": "1.2.4",
"jquery": "2.2.2",
"jquery-ui": "1.10.5",
"ng2-auto-complete": "^0.7.0",
"ng2-cookies": "^0.1.5",
"ng2-file-upload": "^1.0.0-beta.1",
"node-sass": "^3.8.0",
"normalize.css": "^4.1.1",
"path-to-regexp": "^1.5.3",
"postcss": "^5.0.19",
"postcss-loader": "^0.8.2",
"primeng": "1.0.0-beta.15",
"primeui": "4.1.10",
"resolve-url-loader": "^1.6.0",
"rxjs": "^5.0.1",
"sass-loader": "^3.2.3",
"style-loader": "^0.13.1",
"tether": "^1.2.0",
"typescript": "^2.1.5",
"url-loader": "^0.5.7",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/compiler-cli": "4.0.0",
"angular2-hmr": "~0.5.5",
"awesome-typescript-loader": "~0.17.0",
"babel-core": "^6.2.1",
"babel-loader": "^6.2.0",
"babel-plugin-transform-es2015-modules-commonjs-simple": "^6.7.0",
"babel-preset-es2015": "^6.1.18",
"babel-preset-es2015-webpack": "^6.4.0",
"bootstrap": "4.0.0-alpha.2",
"bootstrap-loader": "1.0.10",
"codelyzer": "0.0.15",
"compression-webpack-plugin": "^0.3.1",
"copy-webpack-plugin": "^2.1.3",
"css-loader": "^0.23.1",
"es6-promise": "^3.1.2",
"es6-promise-loader": "^1.0.1",
"es6-shim": "^0.35.0",
"exports-loader": "^0.6.3",
"expose-loader": "^0.7.1",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.8.5",
"html-webpack-plugin": "^2.15.0",
"http-server": "^0.9.0",
"imports-loader": "^0.6.5",
"istanbul-instrumenter-loader": "^0.2.0",
"json-loader": "^0.5.4",
"karma": "^0.13.22",
"karma-chrome-launcher": "^0.2.3",
"karma-coverage": "^0.5.5",
"karma-jasmine": "^0.3.8",
"karma-mocha-reporter": "^2.0.0",
"karma-phantomjs-launcher": "^1.0.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "1.7.0",
"lodash": "^4.6.1",
"moment": "^2.11.2",
"node-sass": "3.7.0",
"npmconf": "2.1.2",
"parse5": "^2.1.5",
"phantomjs-polyfill": "0.0.2",
"phantomjs-prebuilt": "^2.1.7",
"protractor": "^3.2.2",
"raw-loader": "0.5.1",
"reflect-metadata": "^0.1.3",
"remap-istanbul": "^0.6.3",
"resolve-url-loader": "^1.4.3",
"rimraf": "^2.5.2",
"sass-loader": "^3.2.0",
"source-map-loader": "^0.1.5",
"style-loader": "^0.13.1",
"ts-helpers": "1.1.1",
"ts-node": "^0.7.1",
"tslint": "^3.7.1",
"tslint-loader": "^2.1.3",
"typedoc": "^0.3.12",
"typescript": "^2.1.5",
"typings": "^0.8.1",
"url-loader": "^0.5.7",
"webpack": "^1.12.14",
"webpack-dev-server": "^1.14.1",
"webpack-load-plugins": "^0.1.2",
"webpack-md5-hash": "^0.0.5",
"webpack-merge": "^0.12.0",
"webpack-validator": "^1.0.0-beta.4"
}
“tsconfig.json”
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"lib" : ["es2015.iterable.ts"],
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"noEmitHelpers": true
},
"exclude": [
"node_modules",
"typings/main.d.ts",
"typings/main"
],
"filesGlob": [
"./src/**/*.ts",
"./test/**/*.ts",
"!./node_modules/**/*.ts",
"src/custom_typings.d.ts",
"typings/browser.d.ts"
],
"awesomeTypescriptLoaderOptions": {
"resolveGlobs": true,
"forkChecker": true
},
"compileOnSave": false,
"buildOnSave": false,
"atom": { "rewriteTsconfig": false }
}
最佳答案
尝试向您的 tsconfig 添加额外的库。在我的项目中,我为 angular4 设置了以下库:
"lib": [
"es5",
"es2015",
"es2017",
"dom",
"scripthost"
]
如果这不起作用,作为一种解决方法,您可以尝试在 compilerOptions
中为您的 tsconfig.json 使用 "allowJs": true
,尽管我只会考虑修复存储库可能有问题的解决方法。
关于Angular 2.4.10 到 4.0.0 的迁移问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43053064/
我正在尝试在项目中学习和添加 Angular 国际化。我只能理解 Angular 文档 (https://angular.io/guide/i18n-overview) 的编译时翻译。 我需要这样的东
在我的 Angular 应用程序中,基于登录用户,我想通过显示/隐藏不同的菜单项或允许/禁止某些路由来授予或限制功能。 目前成功登录后,我的 .NET Core API 会返回一个 JWT token
我是 Angular 的新手,目前我已经看过 angular.io 网站提供的一些示例。但是在component decorator在文档中的解释,它指出 Angular components are
这里是service employee-service.service.ts的代码 import { Injectable } from '@angular/core'; import { HttpC
我目前正在使用@angular/http URLSearchParams 类来检索 URL 参数。在 Angular 5 中,注意到这已被弃用,但我没有看到以我当前使用的方式替换 URLSearchP
我目前正在使用@angular/http URLSearchParams 类来检索 URL 参数。在 Angular 5 中,注意到这已被弃用,但我没有看到以我当前使用的方式替换 URLSearchP
如何正确安装 PUG/JADE 到 Angular 2 或更高版本 这样在工作和 AOT 和 JiT 的同时 工作单元和集成测试 并且在创建每个新组件时不会受到太多影响 最佳答案 我看到了很多解决方案
我的 Angular 12 应用程序中有一些通用组件,我计划将其创建为一个 Angular 库,以便其他应用程序也可以使用它。我们有一些应用程序在较低版本的 angular(例如 angular 8/
tl;dr; ng build 删除了包含我编译的自定义库的/dist 文件夹。这会使我项目代码中对该库的所有引用无效,从而导致 ng build 最终失败。我做错了什么? 我关注了documenta
我正在将一些“遗留”(非 typescript )js 库导入到我的 Angular SPA 中。 通常我只是从 cdn 添加一个负载到 index.html 就像: 在 Angular 分量中我只
我有这个 angular 应用程序,它基本上使用了库的概念。 我有 2 个名为 的库Lib1 和 lib2 根据他们所服务的微服务分组。 现在我将这些库导入主应用程序,即 应用1 事情一直到现在。 现
我在我的项目中启用了 angular Universal。我现在想完全删除它。我试图删除以下文件 /server.ts /webpack.server.config.js /src/tsconfig.
我已经有一个 AuthService 在登录时对用户进行身份验证,并且 AuthGuard 在未登录的情况下阻止访问。 某些页面我通过 UserProfile/Role 限制访问,但现在我需要阻止页面
我正在尝试使用 angular、TypeORM、SQLite 和其他组件作为 webpack 构建 Electron 应用程序。 我从在 GitHub 上找到的示例开始我的开发:https://git
我在从 Angular 8 更新到 9 并运行时遇到以下错误 ng 更新@angular/material: Package "@angular/flex-layout" has an incompa
我正在尝试使用 Angular 9,我想创建一个项目,然后创建一个库项目并开始向其中添加我想稍后在 GitHub 上发布的通用模块,并在我的本地使用这些库项目。 相关依赖如下: Angular CLI
我正在尝试使用 Angular 9,我想创建一个项目,然后创建一个库项目并开始向其中添加我想稍后在 GitHub 上发布的通用模块,并在我的本地使用这些库项目。 相关依赖如下: Angular CLI
我正在我的 h1 元素“之前”创建一个小的程式化三 Angular 形图案,但我无法正确地圆 Angular 。右上角没问题,但其他两个有剪裁问题。 这是输出以及形状的放大图像: 使用的代码如下: h
我有一个 Angular 元素,带有自定义标记名 - fancy-button。如何将 fancy-button 嵌入 Angular 应用程序? 我已经尝试了以下方法,但都没有用 - 在 index
我已将我的项目从 angular 5.2.9 升级到 angular 6.0.0-rc.5。 除了包路径中的几个快速 RxJS 修复外,一切看起来都不错。(此链接非常有用:Want to upgrad
我是一名优秀的程序员,十分优秀!