Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run fails when project contains node_modules directory. #333

Open
matejvasek opened this issue May 19, 2022 · 4 comments
Open

Run fails when project contains node_modules directory. #333

matejvasek opened this issue May 19, 2022 · 4 comments

Comments

@matejvasek
Copy link

matejvasek commented May 19, 2022

When trying to build & running an image from a project containing the node_modules directory I got following error:

s2i build ./ registry.access.redhat.com/ubi8/nodejs-16 quay.io/mvasek/fn-n:latest

node:internal/modules/cjs/loader:936load Completed in 38ms
  throw err;
  ^

Error: Cannot find module '../'
Require stack:
- /opt/app-root/src/node_modules/.bin/faas-js-runtime
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/opt/app-root/src/node_modules/.bin/faas-js-runtime:4:29)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/opt/app-root/src/node_modules/.bin/faas-js-runtime' ]
}

With NodeJS 14 I got different error:

s2i build ./ registry.access.redhat.com/ubi8/nodejs-14 quay.io/mvasek/fn-n:latest

---> Installing application source ...
---> Installing all dependencies
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

audited 298 packages in 1.739s

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

found 7 vulnerabilities (4 high, 3 critical)
run `npm audit fix` to fix them, or `npm audit` for details
---> Building in production mode
---> Pruning the development dependencies
npm ERR! code EEXIST
npm ERR! path /opt/app-root/src/node_modules/.bin/tape
npm ERR! Refusing to delete /opt/app-root/src/node_modules/.bin/tape: is outside /opt/app-root/src/node_modules/tape and not a link
npm ERR! File exists: /opt/app-root/src/node_modules/.bin/tape
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     /opt/app-root/src/.npm/_logs/2022-05-14T15_46_23_798Z-debug.log
Build failed
ERROR: An error occurred: non-zero (13) exit code from registry.access.redhat.com/ubi8/nodejs-14

I had to either delete the node_modules or put it into s2i ignore list.

Is this expected behaviour?

@lholmquist
Copy link
Member

cc @pkubatrh

@matejvasek
Copy link
Author

inb4 use the --exclude flag: the flag is not working with --as-dockerfile mode.

@matejvasek matejvasek changed the title Build fails when project contains node_modules directory. Run fails when project contains node_modules directory. Mar 9, 2023
@matejvasek
Copy link
Author

/kind bug

@matejvasek
Copy link
Author

inb4 use the --exclude flag: the flag is not working with --as-dockerfile mode.

at least .s2iignore seems to work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants