#error during build:Error: EPERM: operation not permitted, scandir '/proc/1/map_files'

1 messages · Page 1 of 1 (latest)

storm inlet
#

    // build the application
    isBuild, err := runner.WithEnvVariable(
        "NODE_OPTIONS", // TODO tricky 🤔 set NODE_OPTIONS in .npmrc,but its not working。
        "--max-old-space-size=8192").WithMountedCache("node_modules", dependencyCache).WithExec([]string{"pnpm", "build"}).Directory("dist/").Export(ctx, "dist")
    if err != nil {
        panic(err)
    }

    str := "failed"
    if isBuild {
        str = "successed"
    }

    fmt.Println(chalk.Red, "build: "+str, chalk.Reset)

I'm a front-end developer, and I'm trying to build my application with dagger. As the code shows, the build works fine on my MACOS, but on centos it reports an error:
error during build.
Error: EPERM: operation not permitted, scandir '/proc/1/map_files'
How do I fix it?

#

ping

pearl quartz
#

👋 can you share the complete pipeline? How are you calling the WithDirectory? method?

storm inlet
# pearl quartz 👋 can you share the complete pipeline? How are you calling the `WithDirectory`?...

package main
import (
"context"
"fmt"
"os"

"dagger.io/dagger"
"github.com/ttacon/chalk"

)

func main() {
ctx := context.Background()
client, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stdout), dagger.WithWorkdir(".."))
if err != nil {
panic(err)
}
defer client.Close()
container := client.Container()

dependencyCache := client.CacheVolume("dependencyCache")

source := client.Host().Directory(".", dagger.HostDirectoryOpts{
    Exclude: []string{"node_modules"},
})


node := container.From("node:20-slim")
version, err := node.WithExec([]string{"node", "-v"}).Stdout(ctx)
if err != nil {
    panic(err)
}
packageManager := node.
    WithExec([]string{"corepack", "enable"}).
    WithExec([]string{"corepack", "prepare", "pnpm@8.6.4", "--activate"})
packageManagerVersion, err := packageManager.WithExec([]string{"pnpm", "-v"}).Stdout(ctx)
if err != nil {
    panic(err)
}




runner := packageManager.WithDirectory(".", source, dagger.ContainerWithDirectoryOpts{
    Exclude: []string{"node_modules"},
}).WithExec([]string{"pnpm", "install"})
_, err = runner.Stdout(ctx)
if err != nil {
    panic(err)
}


isBuild, err := runner.WithEnvVariable(
    "NODE_OPTIONS", 
    "--max-old-space-size=8192").WithMountedCache("node_modules", dependencyCache).WithExec([]string{"pnpm", "build"}).Directory("dist/").Export(ctx, "dist")
if err != nil {
    panic(err)
}

}

storm inlet
pearl quartz
#

can you try changing this line:

        Exclude: []string{"nodemodules"},
    }).WithExec([]string{"pnpm", "install"})
    , err = runner.Stdout(ctx)```
to this? 

runner := packageManager.WithDirectory("/app", source, dagger.ContainerWithDirectoryOpts{
    Exclude: []string{"nodemodules"},
}).WithWorkdir("/app").WithExec([]string{"pnpm", "install"})
, err = runner.Stdout(ctx)
storm inlet
#

Sorry sir, I'm a Discord newbie;
Thank you very much for your reply, I'll give it a try