Skip to content

Can't install and use rsshub npm package #14930

@cawa-93

Description

@cawa-93

Routes

NOROUTE 

Full routes

NOROUTE 

Related documentation

https://docs.rsshub.app/guide/#install

What is expected?

Some kind of rss data in console logs

What is actually happening?

I installed the package according to the documentation. But when I try to run it, I get an error.

node:internal/modules/esm/get_format:160
  throw new ERR_UNKNOWN_FILE_EXTENSION(ext, filepath);
        ^

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for C:\Users\kozac\dev\lazy-stalker-bot\node_modules\.pnpm\rsshub@1.0.0-master.76bc721\node_modules\rsshub\lib\pkg.ts
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:160:9)
    at defaultGetFormat (node:internal/modules/esm/get_format:203:36)
    at defaultLoad (node:internal/modules/esm/load:143:22)
    at async ModuleLoader.load (node:internal/modules/esm/loader:409:7)
    at async ModuleLoader.moduleProvider (node:internal/modules/esm/loader:291:45) {
  code: 'ERR_UNKNOWN_FILE_EXTENSION'
}

After examining the contents of the package, I saw that it contains only TypeScript files.

Deployment information

Self-hosted

Deployment information (for self-hosted)

self-hosted

Additional info

I'm using `pnpm` as package manager. Node.js v21.5.0

This is not a duplicated issue

  • I have searched existing issues to ensure this bug has not already been reported

Activity

github-actions

github-actions commented on Mar 23, 2024

@github-actions
changed the title [-]Cannot install and use `rsshub` npm package[/-] [+]Can't install and use `rsshub` npm package[/+] on Mar 23, 2024
github-actions

github-actions commented on Mar 23, 2024

@github-actions
added
core bugOuch! That hurts.
and removed
RSS bugSomething isn't working
on Apr 4, 2024
alTach

alTach commented on May 13, 2024

@alTach

Error 1
image

error text for seo/search node_modules/rsshub/lib/pkg.ts:1:27 - error TS2307: Cannot find module '@/config' or its corresponding type declarations.

1 import { setConfig } from '@/config';
~~~~~~~~~~

node_modules/rsshub/lib/pkg.ts:15:25 - error TS2307: Cannot find module '@/app' or its corresponding type declarations.

15 app = (await import('@/app')).default;
~~~~~~~

[8:39:04 PM] Found 2 errors. Watching for file changes.

description: Obviously, there is a problem with paths, it is necessary to make sure that the paths are updated when the project is published
solution: i added the next code in tsconfig:

"paths": {
      "@/*": ["node_modules/rsshub/lib/*"],
      "@/app": ["node_modules/rsshub/lib/app.tsx"],
    },  

but then i got error 2

Error 2
image

error text for seo/search node_modules/rsshub/lib/pkg.ts:15:25 - error TS6142: Module '@/app' was resolved to '/Users/turachaliev/Documents/social-inbox/telegram/node_modules/rsshub/lib/app.tsx', but '--jsx' is not set.

15 app = (await import('@/app')).default;
~~~~~~~

[8:38:18 PM] Found 1 error. Watching for file changes.

description: Something related to JSX
solution: I noticed that there is a mention of jsx in the tsconfig file of the project, so I copied the setting

{
...
  "jsx": "react-jsx",
  "jsxImportSource": "hono/jsx",
  "paths": {
    "@/*": ["node_modules/rsshub/lib/*"],
    "@/app": ["node_modules/rsshub/lib/app.tsx"],
  }, 
  ...
}

then i catch error3

Error 3
image
description: as I understand it, the project is not ready yet, but i will closely follow the updates and look forward to it

error text for seo/search node_modules/rsshub/lib/api/radar/rules/all.ts:31:46 - error TS2339: Property 'push' does not exist on type 'string | RadarItem[]'. Property 'push' does not exist on type 'string'.

31 radar[domain][subdomain].push({
~~~~

node_modules/rsshub/lib/api/radar/rules/one.ts:31:46 - error TS2339: Property 'push' does not exist on type 'string | RadarItem[]'.
Property 'push' does not exist on type 'string'.

31 radar[domain][subdomain].push({
~~~~

node_modules/rsshub/lib/registry.ts:11:46 - error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.

11 const __dirname = path.dirname(fileURLToPath(import.meta.url));
~~~~~~~~~~~

node_modules/rsshub/lib/utils/proxy/unify-proxy.ts:8:5 - error TS2322: Type '{ protocol?: string; host?: string; port?: string; auth?: string; url_regex: string; } | {}' is not assignable to type '{ protocol?: string; host?: string; port?: string; auth?: string; url_regex: string; }'.
Property 'url_regex' is missing in type '{}' but required in type '{ protocol?: string; host?: string; port?: string; auth?: string; url_regex: string; }'.

8 proxyObj = proxyObj || {};
~~~~~~~~

node_modules/rsshub/lib/config.ts:41:9
41 url_regex: string;
~~~~~~~~~
'url_regex' is declared here.

node_modules/rsshub/lib/utils/request-rewriter/get.ts:10:5 - error TS2322: Type '(this: any, ...args: Parameters) => ReturnType' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to '(this: any, ...args: Parameters) => ReturnType'.

10 function (this: any, ...args: Parameters) {
~~~~~~~~

node_modules/rsshub/lib/utils/request-rewriter/get.ts:9:22
9 const getWrappedGet: (origin: T) => T = (origin) =>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The expected type comes from the return type of this signature.

node_modules/rsshub/lib/utils/request-rewriter/get.ts:26:39 - error TS2339: Property 'href' does not exist on type 'RequestOptions'.

26 url = new URL(options.href || ${options.protocol || 'http:'}//${options.hostname || options.host}${options.path}${options.search || (options.query ? ?${options.query} : '')});
~~~~

node_modules/rsshub/lib/utils/request-rewriter/get.ts:26:140 - error TS2339: Property 'search' does not exist on type 'RequestOptions'.

26 url = new URL(options.href || ${options.protocol || 'http:'}//${options.hostname || options.host}${options.path}${options.search || (options.query ? ?${options.query} : '')});
~~~~~~

node_modules/rsshub/lib/utils/request-rewriter/get.ts:26:159 - error TS2339: Property 'query' does not exist on type 'RequestOptions'.

26 url = new URL(options.href || ${options.protocol || 'http:'}//${options.hostname || options.host}${options.path}${options.search || (options.query ? ?${options.query} : '')});
~~~~~

node_modules/rsshub/lib/utils/request-rewriter/get.ts:26:179 - error TS2339: Property 'query' does not exist on type 'RequestOptions'.

26 url = new URL(options.href || ${options.protocol || 'http:'}//${options.hostname || options.host}${options.path}${options.search || (options.query ? ?${options.query} : '')});
~~~~~

node_modules/rsshub/lib/views/atom.tsx:17:15 - error TS2339: Property 'icon' does not exist on type 'Data'.

17 {data.icon && {data.icon}}
~~~~

node_modules/rsshub/lib/views/atom.tsx:17:35 - error TS2339: Property 'icon' does not exist on type 'Data'.

17 {data.icon && {data.icon}}
~~~~

node_modules/rsshub/lib/views/atom.tsx:18:15 - error TS2339: Property 'logo' does not exist on type 'Data'.

18 {data.logo && {data.logo}}
~~~~

node_modules/rsshub/lib/views/atom.tsx:18:35 - error TS2339: Property 'logo' does not exist on type 'Data'.

18 {data.logo && {data.logo}}
~~~~

node_modules/rsshub/lib/views/atom.tsx:41:23 - error TS2339: Property 'upvotes' does not exist on type 'DataItem'.

41 {item.upvotes ? rsshub:upvotes{item.upvotes}</rsshub:upvotes> : ''}
~~~~~~~

node_modules/rsshub/lib/views/atom.tsx:41:55 - error TS2339: Property 'upvotes' does not exist on type 'DataItem'.

41 {item.upvotes ? rsshub:upvotes{item.upvotes}</rsshub:upvotes> : ''}
~~~~~~~

node_modules/rsshub/lib/views/atom.tsx:42:23 - error TS2339: Property 'downvotes' does not exist on type 'DataItem'.

42 {item.downvotes ? rsshub:downvotes{item.downvotes}</rsshub:downvotes> : ''}
~~~~~~~~~

node_modules/rsshub/lib/views/atom.tsx:42:59 - error TS2339: Property 'downvotes' does not exist on type 'DataItem'.

42 {item.downvotes ? rsshub:downvotes{item.downvotes}</rsshub:downvotes> : ''}
~~~~~~~~~

node_modules/rsshub/lib/views/atom.tsx:43:23 - error TS2339: Property 'comments' does not exist on type 'DataItem'.

43 {item.comments ? rsshub:comments{item.comments}</rsshub:comments> : ''}
~~~~~~~~

node_modules/rsshub/lib/views/atom.tsx:43:57 - error TS2339: Property 'comments' does not exist on type 'DataItem'.

43 {item.comments ? rsshub:comments{item.comments}</rsshub:comments> : ''}
~~~~~~~~

[8:20:30 PM] Found 19 errors. Watching for file changes.

Azleal

Azleal commented on Jul 1, 2024

@Azleal

I have the same issue here. any solutions?

after9

after9 commented on Sep 2, 2024

@after9
Contributor

any update for this issue?

sparanoid

sparanoid commented on Sep 24, 2024

@sparanoid
quentinyang

quentinyang commented on Oct 22, 2024

@quentinyang

After 9d980d7 the npm package no longer generates pkg.js:

https://www.npmjs.com/package/rsshub/v/1.0.0-master.9d980d7?activeTab=code

This is the last working release:

https://www.npmjs.com/package/rsshub/v/1.0.0-master.aae92ab?activeTab=code

Thanks. You're right. 1.0.0-master.aae92ab works.

ruturajgole

ruturajgole commented on Oct 22, 2024

@ruturajgole

Error 1 image

error text for seo/search
description: Obviously, there is a problem with paths, it is necessary to make sure that the paths are updated when the project is published solution: i added the next code in tsconfig:

"paths": {
      "@/*": ["node_modules/rsshub/lib/*"],
      "@/app": ["node_modules/rsshub/lib/app.tsx"],
    },  

but then i got error 2

Error 2 image

error text for seo/search
description: Something related to JSX solution: I noticed that there is a mention of jsx in the tsconfig file of the project, so I copied the setting

{
...
  "jsx": "react-jsx",
  "jsxImportSource": "hono/jsx",
  "paths": {
    "@/*": ["node_modules/rsshub/lib/*"],
    "@/app": ["node_modules/rsshub/lib/app.tsx"],
  }, 
  ...
}

then i catch error3

Error 3 image description: as I understand it, the project is not ready yet, but i will closely follow the updates and look forward to it

error text for seo/search

Did anyone find a solution to this? I tried defining the paths in tsconfig, but I still get the error that it cannot find '@/config'.
I tried 1.0.0-master.aae92ab, but it doesn't work with Typescript despite defining a d.ts.

TonyRL

TonyRL commented on Jun 27, 2025

@TonyRL
Collaborator

Duplicate of #14663

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    core bugOuch! That hurts.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @sparanoid@cawa-93@after9@Azleal@TonyRL

        Issue actions

          Can't install and use `rsshub` npm package · Issue #14930 · DIYgod/RSSHub