相关疑难解决方法(0)

模块“rxjs”没有导出成员“firstValueFrom”

App.service 文件如下所示:

import { Injectable } from '@nestjs/common';
import { HttpService } from '@nestjs/axios';
import { Observable, firstValueFrom } from 'rxjs';
// import { firstValueFrom } from 'rxjs';

@Injectable()
export class AppService {
  constructor(private httpService: HttpService) {}
  async getWeatherForecasts() {
    const url =
      'http://www.7timer.info/bin/api.pl?lon=113.17&lat=23.09&product=astro&output=json';
    const { data } = await firstValueFrom(this.httpService.get(url));
    return data;
  }
}
Run Code Online (Sandbox Code Playgroud)

Package.json 文件如下所示:

  "dependencies": {
    "@fmr-pr103625/nest-scaffold": "^1.5.5",
    "@nestjs/apollo": "^10.0.9",
    "@nestjs/axios": "0.0.7",
    "@nestjs/common": "^7.6.18",
    "@nestjs/core": "^7.6.18",
    "@nestjs/graphql": "^10.0.9",
    "@nestjs/platform-express": "^7.6.18",
    "apollo-server-express": "^3.6.7",
    "axios": "^0.27.2",
    "graphql": "^16.3.0",
    "graphql-tools": …
Run Code Online (Sandbox Code Playgroud)

node.js rxjs angularjs nestjs

7
推荐指数
1
解决办法
8858
查看次数

标签 统计

angularjs ×1

nestjs ×1

node.js ×1

rxjs ×1