DIYgod / RSSHub

🧡 Everything is RSSible
https://docs.rsshub.app
MIT License
30.98k stars 6.91k forks source link

Can't install and use `rsshub` npm package #14930

Open cawa-93 opened 3 months ago

cawa-93 commented 3 months ago

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

github-actions[bot] commented 3 months ago
Searching for maintainers:

To maintainers: if you are not willing to be disturbed, list your username in scripts/workflow/test-issue/call-maintainer.js. In this way, your username will be wrapped in an inline code block when tagged so you will not be notified.

If all routes can not be found, the issue will be closed automatically. Please use NOROUTE for a route-irrelevant issue or leave a comment if it is a mistake. 如果所有路由都无法匹配,issue 将会被自动关闭。如果 issue 和路由无关,请使用 NOROUTE 关键词,或者留下评论。我们会重新审核。

github-actions[bot] commented 3 months ago
Searching for maintainers:

To maintainers: if you are not willing to be disturbed, list your username in scripts/workflow/test-issue/call-maintainer.js. In this way, your username will be wrapped in an inline code block when tagged so you will not be notified.

If all routes can not be found, the issue will be closed automatically. Please use NOROUTE for a route-irrelevant issue or leave a comment if it is a mistake. 如果所有路由都无法匹配,issue 将会被自动关闭。如果 issue 和路由无关,请使用 NOROUTE 关键词,或者留下评论。我们会重新审核。

alTach commented 2 months ago

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 ? {item.upvotes} : ''} ~~~~~~~ node_modules/rsshub/lib/views/atom.tsx:41:55 - error TS2339: Property 'upvotes' does not exist on type 'DataItem'. 41 {item.upvotes ? {item.upvotes} : ''} ~~~~~~~ node_modules/rsshub/lib/views/atom.tsx:42:23 - error TS2339: Property 'downvotes' does not exist on type 'DataItem'. 42 {item.downvotes ? {item.downvotes} : ''} ~~~~~~~~~ node_modules/rsshub/lib/views/atom.tsx:42:59 - error TS2339: Property 'downvotes' does not exist on type 'DataItem'. 42 {item.downvotes ? {item.downvotes} : ''} ~~~~~~~~~ node_modules/rsshub/lib/views/atom.tsx:43:23 - error TS2339: Property 'comments' does not exist on type 'DataItem'. 43 {item.comments ? {item.comments} : ''} ~~~~~~~~ node_modules/rsshub/lib/views/atom.tsx:43:57 - error TS2339: Property 'comments' does not exist on type 'DataItem'. 43 {item.comments ? {item.comments} : ''} ~~~~~~~~ [8:20:30 PM] Found 19 errors. Watching for file changes.
Azleal commented 2 weeks ago

I have the same issue here. any solutions?