在Meteor 1.6服务器之间共享`node_modules`. Angular CLI客户端Angular-Meteor子项目? [英] Share `node_modules` between Meteor 1.6 server & Angular CLI client Angular-Meteor subprojects?
问题描述
我一直在使用Angular-Meteor项目中的服务器使用Meteor 1.3.x-1.5.x,该项目具有通过Angular CLI构建的Web客户端.直到Meteor 1.6为止,我一直可以使用通过符号链接共享的单个node_modules
目录来减小客户端和服务器之间的共享共享依赖关系的大小,并按照Angular-Meteor启动器的示例轻松地使其保持同步.应用程序.
I have been using Meteor 1.3.x-1.5.x for the server in an Angular-Meteor project with a web client built via Angular CLI. Up until Meteor 1.6, I have been able to use a single node_modules
directory shared via a symlink to reduce the size of and easily keep in sync the many shared dependencies between the client and server, following the example of the Angular-Meteor starter applications.
但是,从出现在服务器目录根目录中的新package-lock.json
文件中,Meteor 1.6似乎在node_modules
中安装了自己的依赖项,包括许多@angular/*
依赖项,这导致出现以下错误:到多个相互冲突的软件包安装.有什么建议吗?
However, from the new package-lock.json
file appearing in the root of the server directory, Meteor 1.6 appears to install its own dependencies in node_modules
, including many @angular/*
dependencies, which result in me get the following errors due to the multiple, conflicting package installations. Any recommendations?
```
ERROR in ./clients/browser/main.ts
Module build failed: Error: Angular Compiler was detected but it was an instance of the wrong class.
This likely means you have several @ngtools/webpack packages installed. You can check this with `npm ls @ngtools/webpack`, and then remove the extra copies.
at Object.ngcLoader (/Users/keith.gillette/Code/TaskTrain/node_modules/@ngtools/webpack/src/loader.js:458:19)
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./clients/browser/main.ts
ERROR in ./clients/browser/polyfills.ts
Module build failed: Error: Angular Compiler was detected but it was an instance of the wrong class.
This likely means you have several @ngtools/webpack packages installed. You can check this with `npm ls @ngtools/webpack`, and then remove the extra copies.
at Object.ngcLoader (/Users/keith.gillette/Code/TaskTrain/node_modules/@ngtools/webpack/src/loader.js:458:19)
@ multi ./clients/browser/polyfills.ts
ERROR in Error: Error encountered resolving symbol values statically.
Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 194:50 in the original .ts file), resolving symbol NgModule in .../node_modules/ng-http-loader/node_modules/@angular/core/core.d.ts, resolving symbol NgHttpLoaderModule in .../node_modules/ng-http-loader/ng-http-loader.module.d.ts, resolving symbol NgHttpLoaderModule in .../node_modules/ng-http-loader/ng-http-loader.module.d.ts
at positionalError (.../node_modules/@angular/compiler/bundles/compiler.umd.js:25134:35)
at simplifyInContext (.../node_modules/@angular/compiler/bundles/compiler.umd.js:24977:27)
at StaticReflector.simplify (.../node_modules/@angular/compiler/bundles/compiler.umd.js:24991:13)
at StaticReflector.annotations (.../node_modules/@angular/compiler/bundles/compiler.umd.js:24418:41)
at _getNgModuleMetadata (../node_modules/@angular/compiler-cli/src/ngtools_impl.js:138:31)
at _extractLazyRoutesFromStaticModule (.../node_modules/@angular/compiler-cli/src/ngtools_impl.js:109:26)
at .../node_modules/@angular/compiler-cli/src/ngtools_impl.js:129:27
at Array.reduce (native)
at _extractLazyRoutesFromStaticModule (.../node_modules/@angular/compiler-cli/src/ngtools_impl.js:128:10)
at Object.listLazyRoutesOfModule (.../node_modules/@angular/compiler-cli/src/ngtools_impl.js:53:22)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (.../node_modules/@angular/compiler-cli/src/ngtools_api.js:91:39)
at AotPlugin._getLazyRoutesFromNgtools (.../node_modules/@angular/cli/node_modules/@ngtools/webpack/src/plugin.js:241:66)
at _donePromise.Promise.resolve.then.then.then.then.then (.../node_modules/@angular/cli/node_modules/@ngtools/webpack/src/plugin.js:495:24)
at process._tickCallback (internal/process/next_tick.js:109:7)
```
推荐答案
我能够通过以下方式解决此问题:
I was able to resolve this by:
- 全局更新为
node@8.8.1
以匹配与Meteor 1.6捆绑在一起的版本 - 更新到Meteor 1.6
- 将符号链接添加到根
package.json
&package-lock.json
在Meteor目录中 - 删除
node_modules
文件夹并在根package.json
上执行npm install
- 避免对
meteor npm install
的任何调用(我在postinstall
npm脚本中一直在构建bcrypt二进制文件)
- updating to
node@8.8.1
globally to match the version bundled with Meteor 1.6 - updating to Meteor 1.6
- adding symlinks to the root
package.json
&package-lock.json
inside the Meteor directory - deleting the
node_modules
folder and performing annpm install
on the rootpackage.json
- avoiding any calls to
meteor npm install
(which I had been doing in apostinstall
npm script to build the bcrypt binary)
这篇关于在Meteor 1.6服务器之间共享`node_modules`. Angular CLI客户端Angular-Meteor子项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!