Is there a way to use custom arguments for npm install when deploying in Clever Clouds?

138 Views Asked by At

I'm working on a NextJS application which is deployed through Clever Clouds.

One of the newer dependency require the argument --legacy-peer-deps to be passed with npm install.

When deploying to Clever Cloud, the log only shows the command npm install --no-progress, and then fail because of this dependency.

I have tried putting the command in custom environment variable : CC_NODE_BUILD_TOOL or CC_CUSTOM_BUILD_TOOL but the deployment fail the same way.

I have tried putting it in the scripts.install, but this cause the install to recursively call itself each time it is finished.

Is there really no way to circumvent this ? Is there a way to pass the "strict-peer-deps" of npm to false ?

1

There are 1 best solutions below

3
Gaël Reyrol On

You can use a HOOK to run this command after the automatic install step, you can find the list of available hooks here: https://www.clever-cloud.com/doc/develop/build-hooks/.

I advise you to use the CC_POST_BUILD_HOOK environment variable to do this.