Hi,
hope you guys are doing well.
I wonder if somebody of you could give me some hints, how to run charts.js locally (no loading of cdn, npm etc. via internet → just all things on a local pc with no internet connection).
Thank you for help!
Best
Say that you create a project with this structure:
myFolder
package.json
index.html
index.js
node_modules
If you install any program via NPM (without the --global
flag), it will remain as a javascript file under node_modules/charts.js
(or a similar name). [[By the way, when you publish an npm package and someone installs it, it just searches for your scripts and puts them in the user node_modules folder.]]
So:
- Switch to your project folder
- Install via npm (
npm install chart.js --save
)
And then you have it forever there. Check installation instructions here.
Next include something like <script src="./node_modules/chart.js/dist/Chart.js"></script>
Then it will be available other scripts loaded right below (otherwise the stuff is undefined.)
Thank you!! Now everything works fine.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.