我将我的angular 8.x.x项目迁移到angular 9.x.x,当我尝试发布我的库时,它失败并显示以下错误
npm 错误!@candiman/website@9.0.0 prepublishOnly:
node --eval "console.error('ERROR: Trying to publish a package that has been compiled by Ivy. This is not allowed.\nPlease delete and rebuild the package, without compiling with Ivy, before attempting to publish.\n')" && exit 1
有什么变化吗 angular 9
当我运行 npm run start 时,出现以下有关 firebase 的错误。
技术:Angular 版本 9、Firebase、Firestore、Geofirestore Angular CLI。
错误:
ERROR in The target entry-point "@angular/fire/auth" has missing dependencies:
- firebase/auth
- firebase/app
Run Code Online (Sandbox Code Playgroud)
需要注意的依赖:
"@angular/cli": "~9.1.1",
"@angular/core": "~9.1.1",
"@angular/fire": "^5.1.1",
"firebase": "5.10.1",
"geofirestore": "3.2.3",
Run Code Online (Sandbox Code Playgroud)
包 json:
{
"name": "project",
"version": "1.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve -o",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
},
"private": true,
"dependencies": {
"@agm/core": "^1.1.0",
"@angular/animations": "~9.1.1",
"@angular/cdk": "^9.2.0",
"@angular/common": "~9.1.1", …Run Code Online (Sandbox Code Playgroud) 我将 Angular App 从 v8 升级到 v9。该项目使用 Angular 8 和 moment.js 导入自定义 UI 库。
当我构建它时:
WARNING in Entry point '@myLib/catalogue' contains deep imports into
'/Users/xyz/Projects/forms-frontend/node_modules/moment/locale/de'.
This is probably not a problem, but may cause the compilation of entry points to be out of order.
Run Code Online (Sandbox Code Playgroud)
在@myLib/catalogue.js库文件中(在 node_modules 文件夹中),moment.js DE 语言环境被导入如下:
import 'moment/locale/de';
Run Code Online (Sandbox Code Playgroud)
ERROR in Failed to compile entry-point @myLib/catalogue (es2015 as esm2015) due to compilation errors:
node_modules/@myLib/catalogue/fesm2015/catalogue.js:213:26 - error NG1010: Value at position 2 in the NgModule.imports …Run Code Online (Sandbox Code Playgroud) 我想导入所有角度材料模块并用于整体角度项目模板。
angular-material angular-module angular angular9 angular-cli-v9
我有一个 angular 9 应用程序,我在其中从资产文件夹中读取了 api url:
@Injectable()
export class ConfigService {
private configUrl = '../../../assets/config/config.json';
constructor(private loggerService: LoggerService) { }
public async loadConfig(): Promise<any> {
try {
const response = await fetch(this.configUrl);
if (!response.ok) {
throw new Error(response.statusText);
}
return await response.json();
} catch (err) {
this.loggerService.error(`ConfigService 'loadConfig' threw an error on calling ${this.configUrl} : ${err.tostring()}`);
}
}
}
Run Code Online (Sandbox Code Playgroud)
用于读取配置文件的方法在构建后配置角度生产文件中描述。
environment.ts 是
export const environment = {
production: false,
apiUrl: "https://localhost/api/",
};
Run Code Online (Sandbox Code Playgroud)
environment.prod.ts 是
export const environment = …Run Code Online (Sandbox Code Playgroud) 我已经更新了我的 Angular CLI,版本为 10.0.5(全局和本地)并且当我尝试通过以下命令构建我的 angular 项目时 -
ng build
Run Code Online (Sandbox Code Playgroud)
我低于错误 -
架构验证失败,出现以下错误:数据路径“”不应具有其他属性(es5BrowserSupport)。
当我探索这个错误时,我发现-
@angular/cli 要求最低版本 7.3 & @angular-devkit/build-angular 要求最低版本 0.13
但我想我有更新的版本,因为我重新检查过,它显示我已经有了两个包的更新版本。
仅供参考..我不能在 Angular.json 中评论这个选项 (es5BrowserSupport: true),我想保留这个,因为如果我评论这个选项,它会产生其他问题。
现在我不明白我在这里做错了什么。谁能建议一些方法来解决这个问题?因为目前由于这个问题我无法运行我的项目。
仅供参考,我的旧 Angular CLI 版本是-
@angular/cli": "^8.3.20"
Run Code Online (Sandbox Code Playgroud) 在浏览器 prod/aot 模式下运行应用程序时获取消息。下面是我的 main-aot.ts
未捕获的 NullInjectorError: StaticInjectorError(Platform: core)[CompilerFactory]: NullInjectorError: No provider for CompilerFactory!
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { platformBrowser } from '@angular/platform-browser';
//import { AppModuleNgFactory } from './app/app.module.ngfactory';
import { AppModule } from './app/app.module';
enableProdMode();
// tslint:disable-next-line:no-console
/*platformBrowser().bootstrapModuleFactory(AppModuleNgFactory).catch(err => {
console.log('CANNOT LOAD AOT MODULE')
console.dir(AppModuleNgFactory);
console.error(err)
});*/
platformBrowser().bootstrapModule(AppModule).catch(err => {
console.log('CANNOT LOAD AOT MODULE')
console.dir(AppModule);
console.error(err)
});
Run Code Online (Sandbox Code Playgroud) 我最近在尝试使用 angular CLI 创建新组件时开始收到此错误:
newTree.optimize is not a function
Run Code Online (Sandbox Code Playgroud)
发出的命令是:
ng g c test
Run Code Online (Sandbox Code Playgroud)
谷歌搜索只返回来自 Angular CLI v6.x 的文章我试过全局卸载和重新安装 Angular,但没有成功。这是我当前的版本:
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ ? \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | …Run Code Online (Sandbox Code Playgroud) 有问题 jsPDF 的 Angular 9 模块(已安装的类型 + 包本身)
当做 ng serve 时,它工作 当做 ng build --prod 时,它有错误
ERROR in src/app/xxx/xxxx.componentomponent.ts:52:27 - error TS2351: This expression is not constructable.
Type 'typeof jsPDF' has no construct signatures.
52 let pdf = new jsPDF('p', 'mm', 'a4');
~~~~~
src/app/xxx/xxxx.component.ts:7:1
7 import * as jsPDF from 'jspdf';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import …Run Code Online (Sandbox Code Playgroud) 我使用 Angular CLI 9 构建了一个应用程序。我package.json使用以下命令修补了该文件:
{
"scripts": {
"build:prod": "ng build --prod --subresource-integrity",
"prebuild:prod": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' ts-node ./sitemap_generator.ts"
}
}
Run Code Online (Sandbox Code Playgroud)
因此,当我调用 时npm run build:prod,我的 2 个命令将被执行,并且编译器生成的输出文件包含 SRI。
现在,我添加了 appShell :
npm run ng generate appShell -- --client-project my-project
要使用appShell运行构建,我必须使用以下命令:
npm run ng run my-project:app-shell:production
主要问题
但是这个命令调用文件my-project:build:production的配置angular.json,并且不接受参数--subresource-integrity:/
如何修补它以使用SRI 进行 appShell 生产构建?
勇敢者的第二个问题
此 appShell 构建server/在 中创建一个文件夹dist/。它只包含一个main.js文件。我想它在 Node 内部使用来构建 appShell ;有人可以证实吗?那么,我也可以使用 Unversal …
我正在使用 Angular CLI 9.1.1,但需要使用 Angular 8 创建一个项目。
我还有其他使用 Angular 9 的项目,所以我不想全局安装 Angular 8 CLI。
是否有任何选项可以使用 Angular CLI 9 创建 Angular 8 项目?
我在使用 angular 14 的 package.json 安装 ngx-bootstrap 时遇到问题,如下所示:
{
"name": "testproj",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "^14.0.0",
"@angular/common": "^14.0.0",
"@angular/compiler": "^14.0.0",
"@angular/core": "^14.0.0",
"@angular/forms": "^14.0.0",
"@angular/platform-browser": "^14.0.0",
"@angular/platform-browser-dynamic": "^14.0.0",
"@angular/router": "^14.0.0",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^14.0.3",
"@angular/cli": "~14.0.3",
"@angular/compiler-cli": "^14.0.0",
"@types/jasmine": "~4.0.0",
"jasmine-core": "~4.1.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.0.0", …Run Code Online (Sandbox Code Playgroud) angular-cli-v9 ×13
angular ×11
angular-cli ×5
angular9 ×5
typescript ×2
angularfire ×1
app-shell ×1
build ×1
deeplink ×1
firebase ×1
jspdf ×1
npm-install ×1
npm-update ×1
package.json ×1