blubblub / serverless-nest-monorepo

Plugin to run NestJS Apps from Nest Monorepo
MIT License
20 stars 5 forks source link

Not working with Nodejs v16.19.1 and v18.14.0+ #8

Open alexedtionweb opened 1 year ago

alexedtionweb commented 1 year ago
npx serverless mono --nestApp car --command offline
serverless-nest-monorepo: Serverless NestJS Monorepo Plugin Initialized for: car
serverless-nest-monorepo: Building Nest app: car...
serverless-nest-monorepo: Nest app car build finished.
serverless-nest-monorepo: Using serverless configuration from apps/car/serverless.yml
serverless-nest-monorepo: Running: serverless offline --config serverless-car.tmp.yml
/bin/sh: 1: serverless: not found

Exit code: 127
serverless-nest-monorepo: Cleaning up: serverless-car.tmp.yml
gdemiollis commented 1 year ago

Same problem. It only worked with Node 14.

fakereto commented 1 year ago

This issue is because the environment hasn't been created yet when the spawn function is called. This issue can be resolved ensuring that the env = Object.create has been created before the spawn.

async function passthru...
const env = Object.create(process?.env || {});
console.log("Creating child process..."); // My test, new line created.
const child = spawn(exe, args, {
  ...options,
  shell: true,
});
alvincrisuy commented 1 year ago

@fakereto where do we put that part?

thedarkknight197 commented 4 months ago

same issue here