Hi I got this error, May I know how to solve it ?
p
Hi I got this error, May I know how to solve it ?
n
Hi, This error usually pops up because of old node versions
What version of node are you using?
p
v17.3.1
n
Are you building your app with Node 17 as well?
p
I thing so ?
n
And you see that error by just doing
npm run start
or something similar?
p
yes I just run yarn dev
n
Can you try upgrading to typescript
4.7.3
and see if that fixes it?
p
The error still here
n
Can I see your updated package.json file?
Also just to be safe, you should remove your node modules before changing the typescript version
p
I have remove the node modules and reinstall again
n
In your yarn.lock file, search for
"node_modules/tslib"
and see what version it is resolving to should look like this
Copy code
"node_modules/tslib": {
            "version": "2.4.0",
            "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz",
            "integrity": "..."
        },
Search for
tslib@^
instead
Or you could just do
cat node_modules/tslib/package.json
and post the output here
p
tslib@^1.10.0, tslib@^1.8.1: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== tslib@^2.0.0: version "2.4.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==
Copy code
{
  "name": "tslib",
  "author": "Microsoft Corp.",
  "homepage": "https://www.typescriptlang.org/",
  "version": "1.14.1",
  "license": "0BSD",
  "description": "Runtime library for TypeScript helper functions",
  "keywords": [
    "TypeScript",
    "Microsoft",
    "compiler",
    "language",
    "javascript",
    "tslib",
    "runtime"
  ],
  "bugs": {
    "url": "https://github.com/Microsoft/TypeScript/issues"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/Microsoft/tslib.git"
  },
  "main": "tslib.js",
  "module": "tslib.es6.js",
  "jsnext:main": "tslib.es6.js",
  "typings": "tslib.d.ts",
  "sideEffects": false,
  "exports": {
    ".": {
      "module": "./tslib.es6.js",
      "import": "./modules/index.js",
      "default": "./tslib.js"
    },
    "./": "./"
  }
}
n
Right, try
yarn add -D tslib@2.4.0
and see if the error still persists
p
Solved. Thank you so much
n
Happy to help
2 Views