我在 cli 中收到以下警告,想知道新allowedNonPeerDependencies功能有何不同。
WARNING: Option "whitelistedNonPeerDependencies" is deprecated: Use "allowedNonPeerDependencies" instead.
Run Code Online (Sandbox Code Playgroud) npm ci在我的 docker 容器中运行时出现以下错误
$ npm ci
npm WARN tar TAR_ENTRY_ERROR EINVAL: invalid argument, fchown
npm WARN tar TAR_ENTRY_ERROR EINVAL: invalid argument, fchown
npm WARN tar TAR_ENTRY_ERROR EINVAL: invalid argument, fchown
Run Code Online (Sandbox Code Playgroud)
我的配置
node:18.15-alpine
npm: 9.6.2
Run Code Online (Sandbox Code Playgroud)
有没有人遇到过同样的错误并找到解决方法?
我确实找到了这个相关主题,但没有那么有帮助
我创建了一个简单的角度独立组件,它使用注入令牌进行配置:
export const PERSON_DEFAULT_OPTIONS = new InjectionToken<IPersonDefaults>('...')
export interface IPersonDefaults { ... }
export const providePersonDefaultOptions = (options: IPersonDefaults): Provider => ({
provide: PERSON_DEFAULT_OPTIONS,
useValue: options
})
@Component({...})
export class StandaloneComponent {
readonly #config = inject(PERSON_DEFAULT_OPTIONS, {optional: true})
}
Run Code Online (Sandbox Code Playgroud)
然后,在我的 main.ts 中,我只需调用providePersonDefaultOptions()我的价值观,一切都会很好。
现在我已经将该令牌/接口/组件放入 npm 库中。当我尝试再次运行该应用程序时,出现以下错误:
错误:NG0203:inject() 必须从注入上下文调用,例如构造函数、工厂函数、字段初始值设定项或使用的函数
EnvironmentInjector#runInContext
我不明白为什么该代码不能作为 npm 库工作,因为它仍然是一个正在设置的字段初始值设定项。
angular angular-library injection-tokens angular15 angular16
我将自定义图标与带有角度的默认垫子图标一起使用。然而,与我创建的图标相比,垫子图标有点太厚了。
我知道这些图标被视为字体,但是是否可以像更改 svg 的笔划一样更改它?
图标manage_accounts将具有与球体相同的厚度
(我使用class="material-icons-outlined"来获得徽标的轮廓版本)
使用以下命令升级到 Angular 12ng update @angular/core@12 @angular/cli@12会导致我在使用该模式编译时出现以下错误--configuration production。
\xe2\x9c\x96 Index html generation failed.\nundefined:15:4027680: missing \'}\'\nRun Code Online (Sandbox Code Playgroud)\n这是这个问题的重复,但想发布一个正确的问题/答案,因为它肯定会帮助其他人,而且我不知道我们什么时候能够在该线程上再次发布,因为它几天前就关闭了
\n从 迁移cordova到后capacitor,我在运行时收到以下错误ionic s
vendor.js:114293 ERROR Error: Uncaught (in promise): Error: Not implemented on web.
Error: Not implemented on web.
at AppWeb.unimplemented (vendor.js:1941:12)
at node_modules_capacitor_app_dist_esm_web_js.js:40:19
at Generator.next (<anonymous>)
at asyncGeneratorStep (vendor.js:234184:24)
at _next (vendor.js:234206:9)
at vendor.js:234213:7
at new ZoneAwarePromise (polyfills.js:9384:21)
at vendor.js:234202:12
at AppWeb.getInfo (node_modules_capacitor_app_dist_esm_web_js.js:41:7)
at vendor.js:1704:23
at resolvePromise (polyfills.js:9124:19)
at polyfills.js:9019:9
at polyfills.js:9036:25
at rejected (vendor.js:67367:89)
at _ZoneDelegate.invoke (polyfills.js:8112:158)
at Object.onInvoke (vendor.js:136063:25)
at _ZoneDelegate.invoke (polyfills.js:8112:46)
at Zone.run (polyfills.js:7853:35)
at polyfills.js:9197:28
at _ZoneDelegate.invokeTask (polyfills.js:8145:171)
Run Code Online (Sandbox Code Playgroud)
有人知道我错过了什么吗?
我应该如何声明这个类型?
假设我有一个FormGroup
export interface MyType {
myValue: string
}
Run Code Online (Sandbox Code Playgroud)
myForm: FormGroup
myArray: FormArray // <FormControl<MyType>>
constructor(private _formBuilder: FormBuilder) {
myForm = new FormGroup({
myArray: this._formBuilder.array([])
})
}
Run Code Online (Sandbox Code Playgroud)
addElement() {
this.myArray = this.myForm.get('myArray') as unknown as FormArray
this.myArray.push(this.newElement())
}
private _newElement(): FormGroup { // What type to use ?
return this._formBuilder.group({
myValue: ''
})
}
Run Code Online (Sandbox Code Playgroud)
但是当我使用
myArray: FormArray<FormControl<MyType>>
Run Code Online (Sandbox Code Playgroud)
我收到以下错误
Argument of type 'FormGroup<any>' is not assignable to parameter of type 'FormControl<MyType>'.
Type 'FormGroup<any>' is missing the following properties …Run Code Online (Sandbox Code Playgroud) 我按如下方式使用地图,但这不起作用
<google-map #googleMap width="100%" height="100%" (idle)="initClusterer($event)">
<map-marker-clusterer *ngIf="googleMap?.googleMap">
<ng-container *ngFor="let i of items">
<ng-container *ngIf="i.categories | haveCategory: targetCategory">
<map-marker #markerElem [position]="i.position"> </map-marker>
</ng-container>
</ng-container>
</map-marker-clusterer>
</google-map>
Run Code Online (Sandbox Code Playgroud)
import { MarkerClusterer } from '@googlemaps/markerclusterer'
//...
@ViewChild('googleMap', { static: true }) googleMap: GoogleMap
markerCluster?: MarkerClusterer
// ...
initClusterer(e) {
console.log('initClusterer', e)
if (!this.googleMap?.googleMap || this.markerCluster) return
console.log(this.googleMap, this.googleMap.googleMap)
this.markerCluster = new MarkerClusterer({
map: this.googleMap.googleMap,
markers: this.markerElem,
})
}
Run Code Online (Sandbox Code Playgroud)
我确实下载了以下依赖项
npm i @googlemaps/markerclusterer
npm i @types/google.maps --save-dev
而不是markerclustererplus,因为它已被弃用。
但我收到以下错误。
vendor.js:91237 ERROR Error: MarkerClusterer class …Run Code Online (Sandbox Code Playgroud) <!--app component.html-->
<div class="position-relative container">
<div class="row justify-content-center">
<div class="card mt-sm-3 col-md-8">
<div class="card-body">
<h3 class="mb-0">Artist Directory</h3>
<div class="form-group">
<div class="form-label"><strong>For:</strong>
{{ query }}
</div>
<input class="form-control mt-2" type="text">
</div><!-- form-group -->
</div><!-- card-body -->
</div><!-- card -->
</div><!-- row -->
<div class="position-absolute container" style="left: 0; z-index:10">
<div class="row justify-content-center">
<div class="col-sm-10 col-md-8 col-lg-6 col-xl-5">
<div class="list-group">
<a href="#" class="list-group-item list-group-item-action flex-column align-items-start"
*ngFor="let artist of artists">
<div class="media">
<div class="media-body align-self-center">
<h5 class="m-0">{{ artist.name }}</h5>
{{ artist.reknown }}
</div><!-- …Run Code Online (Sandbox Code Playgroud) angular ×8
angular12 ×1
angular13 ×1
angular15 ×1
angular16 ×1
angularbuild ×1
capacitor ×1
cordova ×1
docker ×1
formarray ×1
formgroups ×1
google-maps ×1
mat-icon ×1
ng-packagr ×1
node.js ×1
npm ×1
types ×1
typescript ×1