Did vendored Dependencies changes for NodeJS Application?

Hello,

I want Cloud Build to leverage the node_modules folder that is part of my zip. For this, I followed the instructions provided here, adding GOOGLE_VENDOR_NPM_DEPENDENCIES=true as a build variable to my function.

Screenshot 2024-04-17 at 15.51.03.pngScreenshot 2024-04-17 at 15.48.42.png

From the attached build logs, I can safely say it's been passed on to build pack (with the correct value) but ultimately then ignored.  Within the build phase, I can see it is still performing a yarn install will yarn install --non-interactive --prefer-offline, this is something I would not expected to happen.

Hence, I wanted to know if there has been a change to how vendored Dependencies for NodeJS work or if I'm overlooking something.

 

 

Solved Solved
0 4 107
1 ACCEPTED SOLUTION

Looking again at the documentation you referenced, it says

    npm install

It doesn't have an option for yarn install (my experience is that the docs usually call out both npm and yarn install). Given that it didn't mention yarn install, maybe it means it will only work with npm as the package manager....?🤔

 

......NoCommandLine ......
https://nocommandline.com
        Analytics & GUI for 
App Engine & Datastore Emulator

 

View solution in original post

4 REPLIES 4

1. Did you remember to remove node_modules from the .gcloudignore file in your working directory?

2. Did you also remember to check your local Node.js version is the same as the one you specify during deployment

 

......NoCommandLine ......
https://nocommandline.com
        Analytics & GUI for 
App Engine & Datastore Emulator

Actually, initially, there was no cloudignore present. Then, I added one that excluded only the README.md, but that did not change anything. The Node version is the same, and the weirdest thing is that when I replaced yarn with npm as package manager (not changing anything else), it started working.

Looking again at the documentation you referenced, it says

    npm install

It doesn't have an option for yarn install (my experience is that the docs usually call out both npm and yarn install). Given that it didn't mention yarn install, maybe it means it will only work with npm as the package manager....?🤔

 

......NoCommandLine ......
https://nocommandline.com
        Analytics & GUI for 
App Engine & Datastore Emulator

 

Well, I was under the impression that, given this section, they would support that feature equally for all the supported package managers. But you seem to have a valid point.