# How to use \*require.js\* to load another library inside p5

**URL:** <https://discourse.processing.org/t/how-to-use-require-js-to-load-another-library-inside-p5/23362>\
**Category:** Libraries\
**Created:** [August 19, 2020, 3:25pm UTC](https://discourse.processing.org/t/how-to-use-require-js-to-load-another-library-inside-p5/23362 "2020-08-19T15:25:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![watermelon2020](https://avatars.discourse-cdn.com/v4/letter/w/a698b9/32.png) [@watermelon2020](https://discourse.processing.org/u/watermelon2020)\
**Post date:** [August 19, 2020, 3:25pm UTC](https://discourse.processing.org/t/how-to-use-require-js-to-load-another-library-inside-p5/23362/1 "2020-08-19T15:25:10Z")

</div>

Hi,

I’d like to use the ‘require.js’ library in p5.js to load another library, say ‘fast-csv’

I’ve done locally:

1. npm install fast-csv
2. modify the index.html to include the ‘require’:

\<script src=“[https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js](https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js)”\>\</script\>

1. In the ‘sketch.js’ code:

var csv = require(’./node\_modules/fast-csv’);

But I’m getting error:

Uncaught Error: Module name “node\_modules/fast-csv” has not been loaded yet for context: \_. Use require([])  
[https://requirejs.org/docs/errors.html#notloaded](https://requirejs.org/docs/errors.html#notloaded)  
at makeError (require.min.js:1)  
at Object.s [as require] (require.min.js:1)  
at requirejs (require.min.js:1)  
at sketch.js:20

Could you help? Thanks a lot.

Xuepeng

---

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [August 22, 2020, 9:38am UTC](https://discourse.processing.org/t/how-to-use-require-js-to-load-another-library-inside-p5/23362/2 "2020-08-22T09:38:01Z")

</div>

Hi,

Welcome to the community!

Your question is not really related to p5js but rather to `require.js`.

As mentioned in the error you got, you should check this link :

- [https://requirejs.org/docs/errors.html#notloaded](https://requirejs.org/docs/errors.html#notloaded)

and also :

- [https://requirejs.org/docs/node.html](https://requirejs.org/docs/node.html)
