Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法部署到Heroku #18108

Open
1 task done
WindowsXp-Beta opened this issue Jan 12, 2025 · 7 comments · May be fixed by #18109
Open
1 task done

无法部署到Heroku #18108

WindowsXp-Beta opened this issue Jan 12, 2025 · 7 comments · May be fixed by #18109
Labels
RSS bug Something isn't working

Comments

@WindowsXp-Beta
Copy link

WindowsXp-Beta commented Jan 12, 2025

路由地址

NOROUTE

完整路由地址

NOROUTE

相关文档

https://docs.rsshub.app/deploy/#deploy-to-heroku

预期是什么?

follow文档中部署到Heroku的步骤,将RSSHub部署到Heroku上。

实际发生了什么?

可以成功build,但是程序无法运行。(Process exited with status 1)

部署

自建

部署相关信息

Heroku

额外信息

2025-01-12T20:07:15.492356+00:00 heroku[web.1]: Starting process with command `npm start`
2025-01-12T20:07:16.263582+00:00 app[web.1]: 
2025-01-12T20:07:16.263600+00:00 app[web.1]: > [email protected] start
2025-01-12T20:07:16.263600+00:00 app[web.1]: > cross-env NODE_ENV=production tsx lib/index.ts
2025-01-12T20:07:16.263600+00:00 app[web.1]: 
2025-01-12T20:07:16.636260+00:00 app[web.1]: 
2025-01-12T20:07:16.636269+00:00 app[web.1]: node:internal/modules/run_main:104
2025-01-12T20:07:16.636277+00:00 app[web.1]:     triggerUncaughtException(
2025-01-12T20:07:16.636278+00:00 app[web.1]:     ^
2025-01-12T20:07:16.636409+00:00 app[web.1]: Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'node-network-devtools' imported from /app/lib/utils/request-rewriter/fetch.ts
2025-01-12T20:07:16.636414+00:00 app[web.1]:     at Object.getPackageJSONURL (node:internal/modules/package_json_reader:267:9)
2025-01-12T20:07:16.636415+00:00 app[web.1]:     at packageResolve (node:internal/modules/esm/resolve:768:81)
2025-01-12T20:07:16.636416+00:00 app[web.1]:     at moduleResolve (node:internal/modules/esm/resolve:854:18)
2025-01-12T20:07:16.636417+00:00 app[web.1]:     at defaultResolve (node:internal/modules/esm/resolve:984:11)
2025-01-12T20:07:16.636417+00:00 app[web.1]:     at nextResolve (node:internal/modules/esm/hooks:748:28)
2025-01-12T20:07:16.636424+00:00 app[web.1]:     at resolveBase (file:///app/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/esm/index.mjs?1736712436430:2:3212)
2025-01-12T20:07:16.636425+00:00 app[web.1]:     at resolveDirectory (file:///app/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/esm/index.mjs?1736712436430:2:3584)
2025-01-12T20:07:16.636425+00:00 app[web.1]:     at resolveTsPaths (file:///app/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/esm/index.mjs?1736712436430:2:4073)
2025-01-12T20:07:16.636425+00:00 app[web.1]:     at resolve (file:///app/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/esm/index.mjs?1736712436430:2:4447)
2025-01-12T20:07:16.636425+00:00 app[web.1]:     at nextResolve (node:internal/modules/esm/hooks:748:28) {
2025-01-12T20:07:16.636425+00:00 app[web.1]:   code: 'ERR_MODULE_NOT_FOUND'
2025-01-12T20:07:16.636426+00:00 app[web.1]: }
2025-01-12T20:07:16.636426+00:00 app[web.1]: 
2025-01-12T20:07:16.636426+00:00 app[web.1]: Node.js v23.6.0
2025-01-12T20:07:16.654991+00:00 app[web.1]: npm notice
2025-01-12T20:07:16.654992+00:00 app[web.1]: npm notice New major version of npm available! 10.9.2 -> 11.0.0
2025-01-12T20:07:16.654993+00:00 app[web.1]: npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.0.0
2025-01-12T20:07:16.654993+00:00 app[web.1]: npm notice To update run: npm install -g [email protected]
2025-01-12T20:07:16.654993+00:00 app[web.1]: npm notice
2025-01-12T20:07:16.722614+00:00 heroku[web.1]: Process exited with status 1
2025-01-12T20:07:16.746051+00:00 heroku[web.1]: State changed from starting to crashed

这不是重复的 issue

  • 我已经搜索了 现有 issue,以确保该错误尚未被报告。
@WindowsXp-Beta WindowsXp-Beta added the RSS bug Something isn't working label Jan 12, 2025
@WindowsXp-Beta
Copy link
Author

完全不懂node js,但是通过直觉和chatGPT搞出了一个fix,希望有大神check一下或者给出一个更为正式的fix。顺便AT一下引入这个package的那个PR的作者@GrinZero #17308

diff --git a/package.json b/package.json
index 5d9db59cc..f68d92f11 100644
--- a/package.json
+++ b/package.json
@@ -135,7 +135,8 @@
         "uuid": "11.0.5",
         "winston": "3.17.0",
         "xxhash-wasm": "1.1.0",
-        "zod": "3.24.1"
+        "zod": "3.24.1",
+        "node-network-devtools": "1.0.25"
     },
     "devDependencies": {
         "@babel/preset-env": "7.26.0",
@@ -187,7 +188,6 @@
         "lint-staged": "15.3.0",
         "mockdate": "3.0.5",
         "msw": "2.4.3",
-        "node-network-devtools": "1.0.25",
         "prettier": "3.4.2",
         "remark-parse": "11.0.0",
         "supertest": "7.0.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 889a88fe7..88ed34482 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -273,6 +273,9 @@ importers:
       zod:
         specifier: 3.24.1
         version: 3.24.1
+      node-network-devtools:
+        specifier: 1.0.25
+        version: 1.0.25([email protected])([email protected])([email protected])
     devDependencies:
       '@babel/preset-env':
         specifier: 7.26.0
@@ -421,9 +424,6 @@ importers:
       msw:
         specifier: 2.4.3
         version: 2.4.3([email protected])
-      node-network-devtools:
-        specifier: 1.0.25
-        version: 1.0.25([email protected])([email protected])([email protected])
       prettier:
         specifier: 3.4.2
         version: 3.4.2
-- 

@TonyRL

This comment was marked as outdated.

@TonyRL TonyRL marked this as a duplicate of #15819 Jan 12, 2025
@TonyRL TonyRL closed this as not planned Won't fix, can't repro, duplicate, stale Jan 12, 2025
@WindowsXp-Beta
Copy link
Author

@TonyRL I think it's a different issue. #15819 deals with error in building whereas this one is that we can successfully build but will run into an error in runtime caused by this PR #17308 which introduced 'node-network-devtools' but only put it in the devDependencies so when Heroku builds it in the production mode, this package is omitted and leads to [ERR_MODULE_NOT_FOUND] error shown in my log.

@WindowsXp-Beta
Copy link
Author

I'm not a proficient Node developer so feel free to point out where my understanding is not correct.

@TonyRL TonyRL reopened this Jan 12, 2025
@TonyRL TonyRL marked this as not a duplicate of #15819 Jan 12, 2025
@GrinZero
Copy link
Contributor

我正在检查原因中

GrinZero added a commit to GrinZero/RSSHub that referenced this issue Jan 13, 2025
@GrinZero GrinZero linked a pull request Jan 13, 2025 that will close this issue
9 tasks
@GrinZero
Copy link
Contributor

We need to install node-network-devtools as dependencies. Because the files in Dockerfile will use NODE_ENV=production as the environment variable, this can create an effect similar to pnpm install -- prod, which can indeed cause startup issues during production.
In short, when I try pnpm install --prod, I do encounter the same problem
I'm sorry for the inconvenience caused. This PR will fix the issue: #18109

@GrinZero
Copy link
Contributor

GrinZero commented Jan 13, 2025

👋 Hello, Tony pointed out that Dockerfile will fully install dependencies during construction. Although I can reproduce the issue through pnpm install --prod, it is expected that the problem will not exist during actual operation.
I noticed an additional commit(f61dfa0) in your registry, is this the cause of the problem?
Alternatively, could you provide more additional information? For example, the pnpm-lock.yaml file on your deployment machine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RSS bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants