getBar and getAggregate api are missing on alpaca js object

I am not able to run code given on the link - A Simple Stock Screener Using Node.js (alpaca.markets)
Below are the errors, i am getting… How to fix it?

TypeError: alpaca.getBars is not a function
at Object. (D:\myproj\stockscreener\testalpaca.js:23:21)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions…js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47

const resp = alpaca.getHistoricAggregatesV2(stock,
^

TypeError: alpaca.getAggregates is not a function
at Object. (D:\myproj\stockscreener\testalpaca.js:25:21)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions…js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47