im new in shopify, im having a problem when i try to use the @shopify/shopify-api. Im importing this property from the API.
import Shopify from '@shopify/shopify-api'
When I do the import I get the next error.
Uncaught TypeError: util.inherits is not a function
at node_modules/jsonwebtoken/node_modules/jws/lib/data-stream.js (data-stream.js:39:6)
at __require (chunk-IGMYUX52.js?v=cd28f3b3:40:50)
at node_modules/jsonwebtoken/node_modules/jws/lib/sign-stream.js (sign-stream.js:3:18)
at __require (chunk-IGMYUX52.js?v=cd28f3b3:40:50)
at node_modules/jsonwebtoken/node_modules/jws/index.js (index.js:2:18)
at __require (chunk-IGMYUX52.js?v=cd28f3b3:40:50)
at node_modules/jsonwebtoken/decode.js (decode.js:1:11)
at __require (chunk-IGMYUX52.js?v=cd28f3b3:40:50)
at node_modules/jsonwebtoken/index.js (index.js:2:11)
at __require (chunk-IGMYUX52.js?v=cd28f3b3:40:50)
So I went to the line in the file where is happening the error:
node_modules/jsonwebtoken/node_modules/jws/lib/data-stream.js
And I discovered that error is a property in a node package
if you cant see the image here the code line.
util.inherits(DataStream, Stream);
So I went to the node documentation and i found that method is discouraged, but is not deprecated, therefore it should be working.
here is the description of the method if you cant see the image.
Usage of util.inherits() is discouraged. Please use the ES6 class and extends keywords to get language level inheritance support. Also note that the two styles are semantically incompatible.
Inherit the prototype methods from one constructor into another. The prototype of constructor will be set to a new object created from superConstructor.
This mainly adds some input validation on top of Object.setPrototypeOf(constructor.prototype, superConstructor.prototype). As an additional convenience, superConstructor will be accessible through the constructor.super_ property.
The package in question is named jws, im no so sure the porpouse of this package, I had the idea to modify the file and use prototypal inheritance replacing that code line but I don't know how good an idea it is do that. futhermore I would have to do that for each file that has that problem, i havent found any information about this on intenet.
THANKS FOR YOUR ANSWER!!!