01/15/2021, 8:42 PM
Hi - new to Pulumi and trying out typescript and python examples. Had a question on pulumi new. It creates the node_modules in the same directory as project. Is there a way to install the node_modules where node installs and installs other modules? I understand it is part of .gitignore. Perhaps there is a way to call it so t lets node do the necessary installs wherever it needs to? Thanks for your help!


01/15/2021, 8:58 PM
I'm not sure what you meant by that. Node looks for packages in the node_modukes folder.


01/15/2021, 9:22 PM
Ok yes I understand. But is the node_modules always located in the project directory. Is there not a global node_modules directory like in other languages such as python (part of system) or perhaps a central location where node installs other modules? I am new to typescript as ell and really a python developer trying out ts.
Eg. when I ran an npm install typescript, npm managed and installed the modules at a location. Can these node_mudles not be installed similarly by npm?


01/17/2021, 8:04 PM
Yes, you can use a mono-repo style, compatible with yarn or similar, or you can roll your own. You only need the
in your Pulumi project directories. Your node_modules, package.json, tsconfig.json and any other "super-project" files can go elsewhere. NPM, Mocha etc. all respect this, by looking for the files in any parent directory.
I haven't tried arranging things in other ways, but so long as your "super-project" top-level directory is a parent of your Pulumi directories, it works.
_node___modules_ always goes in the same directory as package.json. I don't think there's a way to have a machine-wide or global _node___modules_ directory. That isn't how npm works, afaik.
Well, there's
npm install -g
... but that's probably not what you want for project-specific packages..


01/18/2021, 2:49 PM
Thank you for all the options tenwit. Will try out the mono-repo style and the -g options.