keystone icon indicating copy to clipboard operation
keystone copied to clipboard

Keystone 25.0.3 fails to build a production release under MSYS2 windows

Open qfunq opened this issue 4 years ago • 3 comments

Keystone 25.0.3 fails to build a production release under MSYS2 windows

To Reproduce

Install MSYS2 and node 14.17.6

yarn create keystone-app app
cd app
yarn build

Expected behaviour

An empty production app to be built.

What happens is:

$ keystone-next build ✨ Building Keystone ✨ Generating Admin UI code ✨ Generating Keystone config code ✨ Building Admin UI info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5 info - Skipping validation of types info - Creating an optimized production build Failed to compile.

ModuleNotFoundError: Module not found: Error: Can't resolve '........\keystone' in 'C:\msys64\home\qfunq\proj\from-serv\node_dev\app2.keystone\admin\pages\api' Did you mean './........\keystone'? Requests that should resolve in the current directory need to start with './'. Requests that start with a name are treated as module requests and resolve within module directories (node_modules). If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.

Error: > Build failed because of webpack errors at C:\msys64\home\qfunq\proj\from-serv\node_dev\app2\node_modules\next\build\index.ts:636:13 at Span.traceAsyncFn (C:\msys64\home\qfunq\proj\from-serv\node_dev\app2\node_modules\next\dist\telemetry\trace\trace.js:60:20) at build (C:\msys64\home\qfunq\proj\from-serv\node_dev\app2\node_modules\next\build\index.ts:124:20) at buildAdminUI (C:\msys64\home\qfunq\proj\from-serv\node_dev\app2\node_modules@keystone-next\keystone\scripts\dist\keystone.cjs.dev.js:209:3) at Object.build (C:\msys64\home\qfunq\proj\from-serv\node_dev\app2\node_modules@keystone-next\keystone\scripts\dist\keystone.cjs.dev.js:582:3) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

System information

MSYS2 under Windows 10

Additional context

The source of the bug is easy to track down:

A part of the keystone code generation system is mistaken into thinking windows style path names are needed, but under MSYS2 these are not understood.

The keystone generated file: C:\msys64\home\qfunq\proj\from-serv\node_dev\knext.keystone\admin\pages\api__keystone_api_build.js contains the first erroneous code (I have got no further, and will be shifting it to a pure linux system as a workaround).

export { default as config } from '..\\..\\..\\..\\keystone';
export default function (req, res) {
  return res.status(500);
}

In the MSYS2 context, the corrected code is:

export { default as config } from '../../../../keystone';
export default function (req, res) {
  return res.status(500);
}

qfunq avatar Oct 05 '21 04:10 qfunq

I had this similar issue as well. This particular patch, available in "@keystone-next/keystone": "26.0.1", fixed the Windows production build bug: https://github.com/keystonejs/keystone/pull/6530.

jgarivera avatar Oct 09 '21 11:10 jgarivera

Glad to hear it worked Jose,

There's a new release of branch 26.0.1, focused on security, which was badly bugged.

On Sat, Oct 9, 2021 at 12:26 PM Jose Gabrielle Rivera < @.***> wrote:

I had this similar issue as well. This particular patch, available in @.***/keystone": "26.0.1", fixed the Windows production build bug: #6530 https://github.com/keystonejs/keystone/pull/6530.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/keystonejs/keystone/issues/6709#issuecomment-939280919, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXVXEQPNXGHPUBKZE2KQMTUGARGPANCNFSM5FK3XOLA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

qfunq avatar Oct 09 '21 14:10 qfunq

And another release ... the authentication is close to finalised. Feel free to try to break it in any way you can! There are many variations, all of which need extensive testing for a production site, i.e 4 different types of user, with associated access rights.

On Sat, 9 Oct 2021, 15:52 Jonathan Weinreich, @.***> wrote:

Glad to hear it worked Jose,

There's a new release of branch 26.0.1, focused on security, which was badly bugged.

On Sat, Oct 9, 2021 at 12:26 PM Jose Gabrielle Rivera < @.***> wrote:

I had this similar issue as well. This particular patch, available in @.***/keystone": "26.0.1", fixed the Windows production build bug: #6530 https://github.com/keystonejs/keystone/pull/6530.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/keystonejs/keystone/issues/6709#issuecomment-939280919, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXVXEQPNXGHPUBKZE2KQMTUGARGPANCNFSM5FK3XOLA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

qfunq avatar Oct 09 '21 18:10 qfunq

Marked as stale, if anyone can reproduce this problem, please comment or open a new issue

dcousens avatar Nov 14 '23 01:11 dcousens