Hi What you've done here is installed a package for a serverside language (in this instance Node) and are now trying to use it in the browser which won't work. As it so happens it looks like JS-YAML has instructions for using a browser also. There are a couple of different ways you could go about this: If you don't want the YAML to be directly accessible by the public you're going to have to write some kind of web app, potentially using Node with a framework like Express that has access to the file system. You'd then use JS-YAML to parse the YAML and construct the HTML serverside which would then be served to visitors when they hit the apps URL. If you don't mind the Yaml being directly accessible you could do it all on the client using the (all be it very breef) instructions on the "Bundled YAML library for browsers" section of this https://github.com/nodeca/js-yaml page. Cheers, Ben. On 8/6/19, John G Heim <jheim@math.wisc.edu> wrote:
Can you load a javascript module in a script embedded in a web page? If so how?
I am trying to write a web page to display values in a yaml data file. I want to read this yaml data, parse it, and display the values. I found there is a javascript module available to do that. I installed it on my linux machine with the command 'apt-get install node-js-yaml'. The examples that come with the code don't work when embedded in a script on a web page. The line where it fails looks like this:
var yaml = require('js-yaml');
I have been googling all day but all I can find are more examples that do not appear to be embedded in a web page.
-- John G. Heim; jheim@math.wisc.edu; 608-263-4189 _______________________________________________ Blind-sysadmins mailing list -- blind-sysadmins@lists.hodgsonfamily.org To unsubscribe send an email to blind-sysadmins-leave@lists.hodgsonfamily.org