jonchurch / tradingview-js-api-tutorial

306 stars 181 forks source link

Tradingview chart not working #5

Closed omgvamp closed 5 years ago

omgvamp commented 5 years ago

I get the following error when running yarn start:

Uncaught TypeError: i.contentWindow.widgetReady is not a function
    at HTMLIFrameElement.n (charting_library.min.js:1)

I found multiple issues referring to this problem:

Tried all the suggestions, but still can't manage to make it work. Was hoping someone knows how to fix this.

Update: fixed

DamianRavi commented 5 years ago

How did you fix it?

zrubenst commented 5 years ago

@omgvamp How did you fix this?

deepartby commented 5 years ago

@zrubenst did you fix this?

zrubenst commented 5 years ago

@kolyabamberg you using React? Disable the built in service worker. If you need a service worker you’ll need to find a different solution or figure out how to disable the service worker for the trading view library folder in the public directory.

lacksfish commented 5 years ago

Check this solution, it worked for me: https://github.com/tradingview/charting-library-examples/issues/110#issuecomment-519492498

valervarga commented 4 years ago

If anyone still having the same issue, this is how I managed to fix it.

As far as my knowledge goes, the problem occurs because react rewrites static files in production and cannot access charting_library directory.

Since we are running the production server with serve, we need to configure it a bit.

  1. install serve-handle dependency. here is it's documentation
  2. create a file named serve.json in the public directory (same level as your index.html file) 3 copy the following code into your newly created file
    {
    "cleanUrls": false
    }

Now you should re-build your application and re-run you server. After these changes I managed to use the -s flag and TradingView together, without any issues.

Hope this will help someone and save you some valuable time.

tyluudinh commented 4 years ago

If anyone still having the same issue, this is how I managed to fix it.

As far as my knowledge goes, the problem occurs because react rewrites static files in production and cannot access charting_library directory.

Since we are running the production server with serve, we need to configure it a bit.

  1. install serve-handle dependency. here is it's documentation
  2. create a file named serve.json in the public directory (same level as your index.html file) 3 copy the following code into your newly created file
{
  "cleanUrls": false
}

Now you should re-build your application and re-run you server. After these changes I managed to use the -s flag and TradingView together, without any issues.

Hope this will help someone and save you some valuable time.

yeah, I want to may thank you for your comment.

soulBit commented 3 years ago

If anyone comes across this thread searching for a similar answer - make sure you have both sets of library folders in your public folder: charting_library and datafeeds