Skip to content

Node.js v6.10.0 与 Node-Mailin v2.5.0 不兼容导致构建失败 #6

@Adonis142857

Description

@Adonis142857

描述

在尝试从源代码构建项目时,遇到了与Node.js和Node-Mailin版本兼容性的问题。推荐使用的 Node.js v6.10.0 与实际依赖的 Node-Mailin v2.5.0 并不兼容。在尝试更新 Node.js 后出现了无法找到 config-default.json 文件的问题。

重现步骤

  1. 克隆项目
  2. 使用 Node.js v6.10.0 进行构建
  3. 运行项目时观察到 Node-Mailin v2.5.0 的不兼容问题
root@ecsLJuT:~/forsaken-mail# npm start

> forsaken-mail@1.0.2 start /root/forsaken-mail
> node ./bin/www


*****
Your current node version (v6.10.0) is not compatible with Node-Mailin v2.5.0 which requires undefined
Please Consider Upgrading your Node version
Love,
the Node-Mailin maintainers. 
*****Node-Mailin******

/root/forsaken-mail/node_modules/node-mailin/lib/node-mailin.js:307
        return new Promise(async function(resolve, reject) {
                           ^^^^^
SyntaxError: missing ) after argument list
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/root/forsaken-mail/node_modules/node-mailin/index.js:19:20)
    at Module._compile (module.js:570:32)

npm ERR! Linux 5.15.0-30-generic
npm ERR! argv "/root/.nvm/versions/node/v6.10.0/bin/node" "/root/.nvm/versions/node/v6.10.0/bin/npm" "start"
npm ERR! node v6.10.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! forsaken-mail@1.0.2 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the forsaken-mail@1.0.2 start script 'node ./bin/www'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the forsaken-mail package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./bin/www
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs forsaken-mail
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls forsaken-mail
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /root/forsaken-mail/npm-debug.log
  1. 尝试更新 Node.js
nvm install 12
nvm use 12
  1. 重新安装依赖时出现无法找到 config-default.json 文件的错误
root@ecsLJuT:~/forsaken-mail# npm install
npm WARN old lockfile 
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile 
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile 
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated shortid@2.2.15: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated ini@1.3.5: Please update to ini >=1.3.6 to avoid a prototype pollution issue
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated source-map-url@0.4.0: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated json3@3.3.2: Please use the native JSON object instead of JSON 3
npm WARN deprecated chokidar@1.7.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

added 415 packages, and audited 416 packages in 40s

33 packages are looking for funding
  run `npm fund` for details

38 vulnerabilities (2 low, 6 moderate, 20 high, 10 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.
root@ecsLJuT:~/forsaken-mail# 
root@ecsLJuT:~/forsaken-mail# npm start

> forsaken-mail@1.0.2 start
> node ./bin/www

warn: Either spamassassin or spamc are not available. Spam score computation is disabled.
internal/modules/cjs/loader.js:818
  throw err;
  ^

Error: Cannot find module '/root/forsaken-mail/config-default.json'
Require stack:
- /root/forsaken-mail/modules/mailin.js
- /root/forsaken-mail/modules/io.js
- /root/forsaken-mail/bin/www
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/root/forsaken-mail/modules/mailin.js:9:14)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/root/forsaken-mail/modules/io.js:4:14)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/root/forsaken-mail/modules/mailin.js',
    '/root/forsaken-mail/modules/io.js',
    '/root/forsaken-mail/bin/www'
  ]
}

预期行为

项目应当能够使用推荐的 Node.js 版本顺利构建。

实际行为

构建过程中出现了版本不兼容和缺失配置文件的问题。

构建环境

  • 操作系统: Ubuntu-22.04-x64
  • Node.js版本: v6.10.0

请问有什么推荐的解决方案吗?或者是否有新的推荐Node.js版本与 Node-Mailin v2.5.0 兼容?

非常感谢

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions