The Espruino Web IDE usually looks in http://www.espruino.com/modules to find anything you've require()d. However if you go into settings/communications then you should find something called Load modules from NPM (BETA) that you can enable, which will drag modules off NPM (assuming they consist of a single js file).
I just tried yours and it doesn't seem to work though - it's loading http://registry.npmjs.org/get-own-property-symbols/-/get-own-property-symbols-0.1.2.tgz but trying to find ./build/get-own-property-symbols.node.js and failing because the path is actually package/build/get-own-property-symbols.js.
I haven't really done much work on NPM support, because most modules I looked at in NPM pulled in loads of dependencies and filled up the available memory - it could be that something has changed or I'm just not dealing with that particular case (the NPM loader's code is here)
Another simple hack is just to stick the JS file's URL into require:
You can use localhost and a server, or you can use the 'project' feature in the Web IDE so that you can pull single files directly off a directory on your hard disk.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi,
The Espruino Web IDE usually looks in http://www.espruino.com/modules to find anything you've
require()
d. However if you go into settings/communications then you should find something calledLoad modules from NPM (BETA)
that you can enable, which will drag modules off NPM (assuming they consist of a single js file).I just tried yours and it doesn't seem to work though - it's loading
http://registry.npmjs.org/get-own-property-symbols/-/get-own-property-symbols-0.1.2.tgz
but trying to find./build/get-own-property-symbols.node.js
and failing because the path is actuallypackage/build/get-own-property-symbols.js
.I haven't really done much work on NPM support, because most modules I looked at in NPM pulled in loads of dependencies and filled up the available memory - it could be that something has changed or I'm just not dealing with that particular case (the NPM loader's code is here)
Another simple hack is just to stick the JS file's URL into require:
You can use localhost and a server, or you can use the 'project' feature in the Web IDE so that you can pull single files directly off a directory on your hard disk.