1

There is a NextJS + React + JSS app. After upgrading to the latest JSS version (21.4.0 ATM) and installing Multisite plugin, the following error appeared on build:

Writing generate-component-builder plugins to C:\app\scripts\temp\generate-component-builder-plugins.ts
Error: EPERM: operation not permitted, open 'C:\app\scripts\temp\generate-component-builder-plugins.ts'

Looks like the file cannot be created. Works well locally. Previously, other files were generated in /temp, but the error did not appear.

4
  • check that temp folder is present
    – Anton
    Oct 13, 2023 at 12:05
  • How did you add the plugin? What command are you using to build?
    – Richard Seal
    Oct 13, 2023 at 12:55
  • Temp folder contains committed 'GraphQLIntrospectionResult.json' file so yes, it is present. To add a plugin I created an app using nextjs-multisite plugin and merged with my current app. Can run it as start:connected or start:production (or just perform yarn build). Site resolving works perfectly fine in local Docker setup. Issue appears during deployment to k8s. Oct 16, 2023 at 13:43
  • I also tried to commit the generated file (for the sake of testing) and received another error which states that the file is here but cannot be open: Error: EPERM: operation not permitted, open 'C:\app\src\temp\componentBuilder.ts. Oct 16, 2023 at 14:09

1 Answer 1

0

Found 2 ways how to solve it.

  1. (Unacceptable). Run rendering container as admin. Added to the rendering Dockerfile:

    USER ContainerAdministrator
    
  2. Upgrading to the latest JSS brought two new records in the /scripts/generate-plugins.ts file (the first two):

    const pluginDefinitions: PluginDefinition[] = [
    {
      distPath: 'scripts/temp/generate-component-builder-plugins.ts',
      rootPath: 'scripts/generate-component-builder/plugins',
      moduleType: ModuleType.ESM,
    },
    {
      distPath: 'scripts/temp/config-plugins.ts',
      rootPath: 'scripts/config/plugins',
      moduleType: ModuleType.ESM,
    },
    {
      distPath: 'src/temp/sitemap-fetcher-plugins.ts',
      rootPath: 'src/lib/sitemap-fetcher/plugins',
      moduleType: ModuleType.ESM,
    },
    ...
    

    I noticed that all the old records distPath values were located under /src so I changed distPath: 'scripts/temp/... to distPath: 'src/temp/.... The error has gone...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.