ton-org / ton

Most popular TON Typescript Library
MIT License
180 stars 43 forks source link

TypeError: axios_1.default.post is not a function #56

Open saltykovdg opened 2 months ago

saltykovdg commented 2 months ago

Hi, I've connected the ton client import { TonClient } from '@ton/ton';, but I'm getting an error every time when I'm communicating with a contract, is it a known issue?

my dependencies:

  "dependencies": {
    "@orbs-network/ton-access": "^2.3.3",
    "@reduxjs/toolkit": "^1.9.7",
    "@ton/core": "^0.57.0",
    "@ton/crypto": "^3.3.0",
    "@ton/ton": "^15.0.0",
    "@tonconnect/protocol": "^2.2.6",
    "@tonconnect/sdk": "^3.0.5",
    "@tonconnect/ui-react": "^2.0.9",
    "@twa-dev/sdk": "^7.8.0",
    "buffer": "^6.0.3",

Error:

2HttpApi.js:263 Uncaught (in promise) TypeError: axios_1.default.post is not a function
    at HttpApi.doCall (HttpApi.js:263:1)
    at HttpApi.callGetMethod (HttpApi.js:235:1)
    at TonClient.runMethod (TonClient.js:40:1)
    at TonClient.callGetMethod (TonClient.js:55:1)
    at Object.get (TonClient.js:372:1)
    at Counter.getCounter (useCounterContract.ts:12:1)
    at Proxy.<anonymous> (openContract.js:38:1)
    at getValue (useCounterContract.ts:49:1)
    at useCounterContract.ts:53:1
    at commitHookEffectListMount (react-dom.development.js:23189:1)
saltykovdg commented 2 months ago

Workaround to fix an issue: add into package.json

"dependencies": {
   ...
   "axios": "^0.28.1",
   ...
 },
 "resolutions": {
   "axios": "^0.28.1"
 },
minhkhoi8888 commented 1 month ago

Does anyone know a solution to fix it?

acdmft commented 1 month ago

i moved my project from Webpack to Vite and the problem was resolved