流星1.6服务器和角CLI客户端角流星子项目之间分享`node_modules`?(Share `n

2019-11-04 12:19发布

我一直用流星的1.3.x-1.5.x版本中通过角CLI建立了一个网络客户端角流星项目的服务器。 直到流星1.6,我已经能够使用单个node_modules通过一个符号链接共享目录,以减少大小和容易保持同步客户端和服务器之间的许多共同的依赖关系,继角流星启动应用程序的例子。

然而,从新package-lock.json出现在服务器的根目录下的文件,流星出现1.6安装在自己的依赖node_modules ,其中包括许多@angular/*相关性,这导致我得到因下列错误多个,冲突包安装。 任何建议?

```
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)
```

Answer 1:

我能够来解决此问题:

  • 更新到node@8.8.1全球范围内,以配合流星1.6捆绑的版本
  • 更新流星1.6
  • 添加符号链接到根package.jsonpackage-lock.json流星目录内
  • 删除node_modules文件夹,并执行npm install在根package.json
  • 避免任何调用meteor npm install (我曾在一个一直在做postinstall NPM脚本构建bcrypt二进制)


文章来源: Share `node_modules` between Meteor 1.6 server & Angular CLI client Angular-Meteor subprojects?