How to share node_modules folder across multiple projects?


#1

Hi there,

is there a way to have a node_modules folder shared by multiple projects? The basic idea is to develop a set of modules (and a number of apps based on these modules). As per default, each module would have its own node_modules folder.

According to the node’s documentation, such a setup is supported. However, it seems that ionic has some problems with it.

When I call “npm run build”, I do get the following error:

npm run build

myApp@0.0.1 build (…)/node-tests/my_module/myApp
ionic-app-scripts build

[15:42:42] ionic-app-scripts 3.1.8
[15:42:42] build dev started …
[15:42:42] ionic-app-script task: “build”
[15:42:42] Error: ENOENT: no such file or directory, open
’(…)/node-tests/my_module/myApp/node_modules/@angular/core/package.json’
Error: ENOENT: no such file or directory, open '(…)/node-tests/my_module/myApp/node_modules/@angular/core/package.json’
at Error (native)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myApp@0.0.1 build: ionic-app-scripts build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myApp@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Any hints?


#2

Did you have solve the issue? I have the same problem.

Thanks
Luca