在多个Ionic项目之间共享相同的node_modules目录

时间:2018-06-30 05:51:41

标签: angular typescript ionic-framework ionic3

我在同一目录中有两个SELECT nama_parent, count( nama_parent ) AS `count` FROM `detail_order` WHERE received_date='2018-06-27' GROUP BY nama_parent ORDER BY nama_parent 项目,如您在此处看到的那样:

https://github.com/napolev/multiple-ionic-projects

Ionic

我希望共享与您在上面看到的相同的. ├── .git ├── App-01 ├── App-02 ├── node_modules ├── .gitignore ├── README.html ├── ... 目录。

两个node_modules项目都使用相同的依赖项。

如果Ionic目录如上所示,我运行以下命令:

node_modules

我得到以下输出:

$ cd ./App-01
$ gulp run

找不到目录[00:38:28] Using gulpfile /node-ionic-11-multiple-ionic-projects/App-01/gulpfile.js [00:38:28] Starting 'set-env'... [00:38:28] Finished 'set-env' after 9.22 ms [00:38:28] Starting 'run'... [00:38:28] Finished 'run' after 13 ms NODE_PATH: ../node_modules ? Looks like a fresh checkout! No ./node_modules directory found. Would you like to install project dependencies? (Y/n) ,该目录应该在同一目录中。

node_modules文件中,我尝试修改环境变量:gulp(您可以在上面看到它已正确修改,指向父目录中的一个),但没有成功。

这是我用来修改NODE_PATH环境变量的gulpfile.js

NODE_PATH

另一方面,如果我将目录var gulp = require('gulp'); var execout = require('execout').execout; var colors = require('colors'); var env = require('gulp-env'); const port = 8101; gulp.task('set-env', function () { env({ vars: { // NODE_PATH: "../", NODE_PATH: "../node_modules", } }) }); gulp.task('run', ['set-env'], () => { execout(`echo NODE_PATH: ` + process.env.NODE_PATH.red.bgYellow); execout(`ionic serve --all -p ${port}`); }); 移至两个应用程序中的任何一个,例如:node_modules,然后再次运行上述命令,则该应用程序将正常运行。输出如下:

App-01

您对在父目录上的$ gulp run [23:58:52] Using gulpfile /multiple-ionic-projects/App-01/gulpfile.js [23:58:52] Starting 'set-env'... [23:58:52] Finished 'set-env' after 3.05 ms [23:58:52] Starting 'run'... [23:58:52] Finished 'run' after 8.87 ms NODE_PATH: ../node_modules Starting app-scripts server: --address 0.0.0.0 --port 8101 --livereload-port 35729 --dev-logger-port 53703 --nobrowser - Ctrl+C to cancel [23:58:57] watch started ... [23:58:57] build dev started ... [23:58:57] clean started ... [23:58:57] clean finished in 5 ms [23:58:57] copy started ... [23:58:57] deeplinks started ... [23:58:57] deeplinks finished in 32 ms [23:58:57] transpile started ... [23:59:01] transpile finished in 4.50 s [23:59:01] preprocess started ... [23:59:01] preprocess finished in 1 ms [23:59:01] webpack started ... [23:59:01] copy finished in 4.87 s [23:59:09] webpack finished in 8.07 s [23:59:09] sass started ... ERR: Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning. [23:59:11] sass finished in 1.49 s [23:59:11] postprocess started ... [23:59:11] postprocess finished in 9 ms [23:59:11] lint started ... [23:59:11] build dev finished in 14.24 s [23:59:11] watch ready in 14.37 s [23:59:11] dev server running: http://localhost:8101/ [OK] Development server running! Local: http://localhost:8101 External: http://192.168.1.194:8101 DevApp: App-01@8101 on HP [23:59:16] lint finished in 5.14 s 目录下如何正确运行这两个应用程序有任何想法吗?

谢谢!

0 个答案:

没有答案