I am trying to use a npm package in my laravel5 app, but I am not aware with node and require, can someone please help me to understand that how can I use the npm packages.
I am trying to use the following package:
https://www.npmjs.com/package/node-movie
Here is my code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script data-main="{!! url() !!}/vendor/lib/require.js" src="{!! url() !!}/vendor/lib/require.js"></script>
<script type="text/javascript">
var imdb = require('imdb-api');
var movie;
imdb.getReq({ name: 'The Toxic Avenger' }, function(err, things) {
movie = things;
});
console.log(movie);
</script>
I am getting the following error in console:
Uncaught Error: Module name "imdb-api" has not been loaded yet for context: _. Use require([])