I want to use the global node_modules ( C:\\Users\\<user_name>\\AppData\\Roaming\\npm\\node_modules
) or common node_modules ( D:\\node_modules
) instead of local node_modules ( D:\\angular\\projects\\project1\\node_modules
).
I want to use the node_modules for various projects.
This is my project structure. D:\\ ├── node_modules (common for all projects) │ ├── Module-N ├── projects │ ├── project1 │ │ ├── src │ │ ├── app │ │ | ├── Module-N (importing from common) | │ ├── project2 │ │ ├── src │ │ ├── app │ │ | ├── Module-N (importing from common) | ├── ....
try working with relative path like when you require you own modules for the global models
for example
assuming we want to get a module from the global node modules and the file we are working on is seats on projects/project1/src
we will do require('../../../node_modules/my_global_model')
尝试查看tsconfig
的路径: https : tsconfig
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.