2

I have angular 7 site - which I have converted into server side rendering (referring mainly https://blog.angular-university.io/angular-universal/).

I am running site on AWS using 'foreever'. I aways see below error inside my foreever error log file:

(node:23488) [DEP0005] DeprecationWarning: Buffer() is deprecated due to 
security and usability issues. Please use the Buffer.alloc(), 
Buffer.allocUnsafe(), or Buffer.from() methods instead.

I have not used any kind of buffer in my code, so my guess is it might be coming from node modules I am using. From above log message I am unable to detect which module is having problem.

My current package.json looks like below:

"dependencies": {
  "@angular/animations": "^7.0.0",
  "@angular/common": "^7.0.0",
  "@angular/compiler": "^7.0.0",
  "@angular/core": "^7.0.0",
  "@angular/forms": "^7.0.0",
  "@angular/http": "^7.0.0",
  "@angular/platform-browser": "^7.0.0",
  "@angular/platform-browser-dynamic": "^7.0.0",
  "@angular/platform-server": "^7.0.0",
  "@angular/router": "^7.0.0",
  "@nguniversal/express-engine": "^7.0.2",
  "@nguniversal/module-map-ngfactory-loader": "^7.0.2",
  "bootstrap": "^3.4.0",
  "chart.js": "^2.7.3",
  "core-js": "^2.6.1",
  "express": "^4.16.2",
  "font-awesome": "^4.7.0",
  "fullcalendar": "^3.9.0",
  "he": "^1.2.0",
  "jquery": "^3.3.1",
  "jw-angular-social-buttons": "^1.0.0",
  "moment": "^2.23.0",
  "ng2-validation": "^4.2.0",
  "primeicons": "^1.0.0",
  "primeng": "^6.1.7",
  "prismjs": "^1.15.0",
  "rxjs": "~6.3.3",
  "ts-loader": "^5.3.2",
  "webpack": "^4.28.3",
  "webpack-cli": "^3.1.2",
  "webpack-dev-server": "^3.1.14",
  "zone.js": "~0.8.26"
} 

Is there any way to get more logs ? Can I neglect this error message for now?

Thanks in advance.

EDIT- My package.json has following:

"build-both": "ng build --prod --output-path=dist/browser && ng run 
ecokrypt-uiapp:server --configuration=publiclocal 
--output-path=dist/server",
"webpack-server": "webpack --config webpack.server.config.js 
--ouput dist/server.js --progress --colors",
"build-and-pack": "npm run build-both && npm run webpack-server",

When I build the application (npm run build-and-pack): I see following in my console: I see 2 warnings related to some System.Import()

> ecokrypt-uiapp@0.0.0 build-and-pack 
/Users/manisha/projects/ecokrypt/repos/ecokrypt-uiapp
> npm run build-both && npm run webpack-server


> ecokrypt-uiapp@0.0.0 build-both 
/Users/manisha/projects/ecokrypt/repos/ecokrypt-uiapp
> ng build --prod --output-path=dist/browser && ng run ecokrypt-uiapp:server 
--configuration=publiclocal --output-path=dist/server


Date: 2019-01-22T06:03:27.567Z
Hash: 6cdc328f7a5e6deddab8
Time: 74400ms
chunk {scripts} scripts.121b013aaa5e9461a940.js (scripts) 632 kB  [rendered]
chunk {0} runtime.ec2944dd8b20ec099bf3.js (runtime) 1.41 kB [entry] 
 [rendered]
chunk {1} main.1c45daaf038705b9a051.js (main) 2.27 MB [initial] [rendered]
chunk {2} polyfills.8b3031f6891125c33792.js (polyfills) 58.2 kB [initial] 
 [rendered]
chunk {3} styles.64324cbe6f1a4899818f.css (styles) 325 kB [initial] 
 [rendered]

Date: 2019-01-22T06:03:52.985Z
Hash: 103ec2f268f0c9fbf2a1
Time: 22538ms
chunk {main} main.js, main.js.map (main) 2.75 MB [entry] [rendered]

> ecokrypt-uiapp@0.0.0 webpack-server 
/Users/manisha/projects/ecokrypt/repos/ecokrypt-uiapp
> webpack --config webpack.server.config.js --ouput dist/server.js --progress 
 --colors

Hash: 8961a2409cb304bef9ec
Version: webpack 4.28.3
Time: 11323ms
Built at: 2019-01-22 11:34:05
    Asset      Size  Chunks             Chunk Names
server.js  9.82 MiB  server  [emitted]  server
Entrypoint server = server.js
[./dist/server/main.js] 2.75 MiB {server} [built]
[./server.ts] 1.93 KiB {server} [built]
[./src lazy recursive] ./src lazy namespace object 160 bytes {server} [built]
[./src sync recursive] ./src sync 160 bytes {server} [built]
[buffer] external "buffer" 42 bytes {server} [built]
[crypto] external "crypto" 42 bytes {server} [built]
[events] external "events" 42 bytes {server} [built]
[fs] external "fs" 42 bytes {server} [built]
[http] external "http" 42 bytes {server} [built]
[https] external "https" 42 bytes {server} [built]
[net] external "net" 42 bytes {server} [built]
[os] external "os" 42 bytes {server} [built]
[path] external "path" 42 bytes {server} [built]
[timers] external "timers" 42 bytes {server} [optional] [built]
[url] external "url" 42 bytes {server} [built]
    + 587 hidden modules

 WARNING in ./node_modules/@angular/core/fesm5/core.js 17170:15-36
 System.import() is deprecated and will be removed soon. Use import() 
instead.
For more info visit https://webpack.js.org/guides/code-splitting/
 @ ./server.ts 6:13-37

WARNING in ./node_modules/@angular/core/fesm5/core.js 17182:15-102
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit https://webpack.js.org/guides/code-splitting/
 @ ./server.ts 6:13-37
user2869612
  • 607
  • 2
  • 10
  • 32

1 Answers1

0

Late answer but better late then never...

It's an old package xhr2 used by webpack-cli, there is an open issue on github.

To solve the issue follow the suggestion on that tread: npm i xhr2 --save

Remy
  • 1,053
  • 1
  • 19
  • 25