简体   繁体   English

如果不是npm软件包,我应该如何/应该更新它?

[英]How/should I update an npm package when it is not the wanted one?

I've been trying to query data on Firebase using querying lists . 我一直在尝试使用查询列表在Firebase上查询数据。

When I attempt something analogous to what is described in that documentation: 当我尝试类似于该文档中描述的内容时:

getMatchesFiltered(matchId: string, filter: string, sortDirection: string, pageIndex: number, pageSize: number){
    let queryObservable = this.db.list('/matches', ref => ref.orderByKey(true).limitToFirst(2));
    return queryObservable;
  }

I got an "Argument of type '{ query: { ...}; }' is not assignable to parameter of type 'FirebaseListFactoryOpts' " error, which led me to this helpful SO post . 我收到“无法将类型'{query:{...};}的参数分配给类型'FirebaseListFactoryOpts'的参数”的错误,这导致我转向了这篇很有帮助的SO帖子 However, when I tried to change the above to 但是,当我尝试将以上内容更改为

getMatchesFiltered(matchId: string, filter: string, sortDirection: string, pageIndex: number, pageSize: number): AngularFireList<Match[]>{
    let queryObservable = this.db.list('/matches', ref => ref.orderByKey(true).limitToFirst(2).valueChanges());
    return queryObservable;
  }

and add AngularFireList to the 'angularfire2/database' imports, I get the following error: 并将AngularFireList添加到'angularfire2 / database'导入中,出现以下错误:

ERROR in src/app/database.service.ts(7,81): error TS2305: Module '"/Users/mf/Desktop/dataJitsu/node_modules/angularfire2/database"' has no exported member 'AngularFireList'. src / app / database.service.ts(7,81)中的错误:错误TS2305:模块'“ / Users / mf / Desktop / dataJitsu / node_modules / angularfire2 / database”'没有导出的成员'AngularFireList'。

This suggests to me that perhaps I have an old version of angularfire2? 这向我暗示也许我有angularfire2的旧版本? Indeed, my package.json says, 确实,我的package.json说,

"angularfire2": "^4.0.0-rc0",

And I believe that the new AngularFireList list stuff is from v. 5.xx? 而且我相信新的AngularFireList列表内容来自5.xx版?

However, when I try to update, it doesn't let me. 但是,当我尝试更新时,它不允许我进行更新。 When I run npm outdated, this is what I see: 当我运行过时的npm时,这是我看到的:

npm已过时,显示angularfire2 WANTED版本仍为4.0.0-rc0

Note that the WANTED version of angularfire2 is still 4.0.0-rc0. 请注意,angularfire2的WANTED版本仍为4.0.0-rc0。

Which brings us finally to my question: How do I figure out which package(s) want my versions to stay where they are? 最终,这使我们想到了一个问题:我如何确定哪个软件包希望我的版本保持原样? In other words, what's holding me back from updating further? 换句话说,是什么让我无法进一步更新? Alternatively, if anyone knows how to solve this problem on the angularfire2 front, I'm all ears for that, too. 另外,如果有人知道如何在angularfire2前端解决此问题,我也很乐意这样做。

The Wanted Version stays at 4.0.0-rc0 because of Semantic Versioning in your package.json ("angularfire2": "^4.0.0-rc0") 由于package.json (“ angularfire2”:“ ^ 4.0.0-rc0”)中的语义版本控制 ,所需Version保持在4.0.0-rc0 package.json

As a consumer, you can specify which kinds of updates your app can accept in the package.json file. 作为使用者,您可以在package.json文件中指定您的应用程序可以接受的更新类型。

If you were starting with a package 1.0.4, this is how you would specify the ranges: 如果您从软件包1.0.4开始,这就是您指定范围的方式:

  • Patch releases: 1.0 or 1.0.x or ~1.0.4 修补程序版本:1.0或1.0.x或〜1.0.4
  • Minor releases: 1 or 1.x or ^1.0.4 次要版本:1或1.x或^ 1.0.4
  • Major releases: * or x 主要版本:*或x

The other issue is hard to say without seeing more relevant code. 如果没有看到更多相关代码,很难说另一个问题。 I would start with checkig this post 我将开始与checkig 这个职位

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Angular2快速入门:我应该如何包括新的npm软件包? - Angular2 quickstart: how should I include a new npm package? 在创建Angular 2库npm包时,我应该对Angular 2依赖项使用peerDependencies还是依赖项? - When creating Angular 2 library npm package, should I use peerDependencies or dependencies for Angular 2 dependencies? 我有npm包的回购叉。 我应该如何使用它? - I've got fork of repo of npm package. How should I use it? npm publish/typescript 在使用我的 npm typescript 包时如何避免丑陋的导入? - npm publish/typescript How can I avoid the ugly import when consuming my npm typescript package? 如何删除/更新异步方式以及何时应退订? - How to delete/update async way and when should I unsubscribe? 更改package.json时,“ npm install”和“ npm update”的行为是什么? - What is the behaviour of “npm install” and “npm update” when changing package.json? 我如何解释NPM中的一个包,抱怨当一个依赖关系没有得到满足时呢? - How do I explain a package in NPM whining about a dependency not being met when it apparently is? Angular 仅复选框 select 当我想要多个值时一个值数据 - Angular checkbox only select one values data when I wanted multiple values 我应该如何编译 angular 模块包? - How should I compile an angular module package? npm / Frameworks /如何知道应该使用哪个版本? - npm/Frameworks/ How to know which Version should I use?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM