由于缺少导入程序,Keystone.js应用程序启动在Heroku上失败了?

问题描述 投票:0回答:1

使用Node 10.15的我的Keystone.js 4项目无法在Heroku上启动:

Error: Cannot find module './lib/core/importer'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/app/node_modules/keystone/index.js:6:16)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    Process exited with status 1
    State changed from crashed to starting
    Starting process with command `node ./dist/keystone.js`
    State changed from starting to crashed
    Process exited with status 1
    internal/modules/cjs/loader.js:583
    throw err;

我有其他Keystone应用程序配置方式与正确运行完全相同。

我已经尝试禁用构建缓存,创建一个要部署到的新应用程序实例,并通过Heroku控制台验证了该文件确实存在于源中。

该项目在本地Windows 10和* nix环境中正确构建和运行。

我该怎么做才能调试这个?

heroku keystonejs
1个回答
0
投票

所以似乎问题是由于npm 6.5.x没有安装所有Keystone的依赖项。切换到Yarn作为包管理器修复此问题。

  • 我安装了最新版的Yarn,1.13.0截至目前。
  • 通过yarn安装的依赖项
  • 提交了yarn.lock文件
  • 在我的package.json的“engines”部分指定"yarn": "1.13.0"并从引擎中删除“npm”。
  • 重新部署到Heroku,它按预期工作。

希望这有助于某人!

© www.soinside.com 2019 - 2024. All rights reserved.