相关疑难解决方法(0)

将Node.js升级到最新版本

所以,我安装了Node.js,现在当我尝试安装Mongoosejs时,我收到一个错误,告诉我我没有所需的Node.js版本(我需要v0.4.11和v0.4.12).

我该如何升级到这个版本?我想我可以用最新版本再次安装它,但我不想在确定我的项目文件夹"node"中的项目文件夹不会被删除之前这样做.

upgrade node.js

643
推荐指数
15
解决办法
74万
查看次数

删除`package-lock.json`以快速解决冲突

通常,在建立团队的过程中,我遇到了合并冲突,package-lock.json而我的快速解决方案一直是删除文件并使用重新生成文件npm install。我尚未认真考虑此修复程序的含义,因为它以前没有引起任何可察觉的问题。

删除文件并以npm这种方式重新创建而不是手动解决冲突是否存在问题?

javascript node.js npm package-lock.json

17
推荐指数
3
解决办法
1万
查看次数

ViewChild 在角度 13 中未定义

我试图从父组件调用子组件的视图子组件,但在控制台中未定义。

查看图像还可以看到相同的堆栈火焰

https://stackblitz.com/edit/angular-ivy-k4m2hp?file=src%2Fapp%2Fhello.component.ts

查看图像还可以看到相同的堆栈火焰

import { Component, Input, OnInit, ViewChild } from '@angular/core';
import { TestChildComponent } from './test-child/test-child.component';

@Component({
  selector: 'hello',
  template: `<h1>this is Hello component {{name}}!</h1>`,
  styles: [`h1 { font-family: Lato; }`],
})
export class HelloComponent {
  @Input() name: string;
@ViewChild('TestChildComponent') testChildComponent: TestChildComponent
  ngOnInit() {
    console.log('calling ngOninit in hello component');
    console.log('going to call test child instance this.TestChildComponent.ngOninit')
   console.log(this.testChildComponent);
  }
}
Run Code Online (Sandbox Code Playgroud)

请帮忙获取子组件

this.testChildComponent

这样我就可以从父级调用子级的 ngOnInit 。

this.testChildComponent.ngOnInit()

html javascript typescript angular angular13

5
推荐指数
1
解决办法
2万
查看次数