Hello everyone,
I try to retrieve the data from the WooCommerce REST API with this code:
constructor() {
this.WooCommerce = WC ({
url : 'https://mysite.com',
consumerKey : 'ck_',
consumerSecret : 'cs_',
});
this.WooCommerce.getAsync("products").then( (data) => {
console.log(data);
}, (err) => {
console.log(err);
});
}
And I get this in the console:
Angular is running in the development mode. Call enableProdMode() to enable the production mode. core.js:33452
[WDS] Live Reloading enabled. client:52
ERROR Error: "Uncaught (in promise): TypeError: process.version.split is not a function
./node_modules/pbkdf2/lib/default-encoding.js@http://localhost:8100/home-home-module.js:41956:48
__webpack_require__@http://localhost:8100/runtime.js:85:30
./node_modules/pbkdf2/lib/async.js@http://localhost:8100/home-home-module.js:41841:23
__webpack_require__@http://localhost:8100/runtime.js:85:30
./node_modules/pbkdf2/browser.js@http://localhost:8100/home-home-module.js:41827:18
__webpack_require__@http://localhost:8100/runtime.js:85:30
./node_modules/crypto-browserify/index.js@http://localhost:8100/home-home-module.js:23626:9
__webpack_require__@http://localhost:8100/runtime.js:85:30
./node_modules/request/lib/helpers.js@http://localhost:8100/home-home-module.js:46924:14
__webpack_require__@http://localhost:8100/runtime.js:85:30
./node_modules/request/index.js@http://localhost:8100/home-home-module.js:46134:15
__webpack_require__@http://localhost:8100/runtime.js:85:30
./node_modules/woocommerce-api/index.js@http://localhost:8100/home-home-module.js:56783:18
__webpack_require__@http://localhost:8100/runtime.js:85:30
./src/app/home/home.page.ts@http://localhost:8100/home-home-module.js:57161:73
__webpack_require__@http://localhost:8100/runtime.js:85:30
./src/app/home/home.module.ts@http://localhost:8100/home-home-module.js:57107:68
__webpack_require__@http://localhost:8100/runtime.js:85:30
invoke@http://localhost:8100/polyfills.js:3365:26
onInvoke@http://localhost:8100/vendor.js:69411:33
invoke@http://localhost:8100/polyfills.js:3364:52
run@http://localhost:8100/polyfills.js:3130:43
scheduleResolveOrReject/<@http://localhost:8100/polyfills.js:3861:36
invokeTask@http://localhost:8100/polyfills.js:3397:31
onInvokeTask@http://localhost:8100/vendor.js:69392:33
invokeTask@http://localhost:8100/polyfills.js:3396:60
runTask@http://localhost:8100/polyfills.js:3174:47
drainMicroTaskQueue@http://localhost:8100/polyfills.js:3565:35
I also resolved errors related to the same issue by following solutions on the forum. The app did not compile after adding this code. Now it compiles successfully, but I don’t retrieve any data and the emulator screen shows nothing.