sciactive / pnotify

Beautiful JavaScript notifications with Web Notifications support.
https://sciactive.com/pnotify/
Apache License 2.0
3.65k stars 513 forks source link

Uncaught ReferenceError: PNotify is not defined #232

Closed erikasland closed 6 years ago

erikasland commented 8 years ago

I first installed PNotify using NPM like so... npm install pnotify --save

It shows that it installed fine in my packages.json file... "pnotify": "^3.0.0"

I then put these two in my head like so... <head><script type="text/javascript" src="pnotify.custom.min.js"></script> <link href="pnotify.custom.min.css" media="all" rel="stylesheet" type="text/css" /></head>

I am getting the following error in my console in my google dev tools... GET http://localhost:8000/pnotify.custom.min.js

When I call something like this using my jQuery... $(document).ready(function(){ $(function(){ new PNotify({ title: 'Regular Notice', text: 'Check me out! I\'m a notice.' }); }); })

And am getting the following... Uncaught ReferenceError: PNotify is not defined GET http://localhost:8000/pnotify.custom.min.css

Is this a bug, or am I just a noob? I would really like to use your product for a project I am doing if you could help me get it working. Thank you.

KrishnaPG commented 8 years ago

Getting the same error with https://cdnjs.cloudflare.com/ajax/libs/pnotify/3.0.0/pnotify.min.js

nicklello commented 7 years ago

Have recently updated from PNotify 2.0.0 to 3.0.0 using a bundle generated via http://sciactive.com/pnotify/ and am getting this problem

ahinkle commented 7 years ago

Getting the same problem as @nicklello. Please comment if you find a solution.

djmattyg007 commented 7 years ago

Do you have multiple copies of jQuery on the page?

nanadjei commented 7 years ago

Am Getting the same error.

cripiLP commented 7 years ago

I have the same issue, downloaded pnotify with all modules from here @djmattyg007 i only have included one jquery

itsykhovskyi commented 7 years ago

try this window.PNotify = require('pnotify/src/pnotify');

hperrin commented 7 years ago

pnotify.custom.min.js is what you would use if you had downloaded the file from the demo page. If you're installing it with NPM, you need to include the files in the dist directory instead.

hperrin commented 7 years ago

If anyone has a different problem, can you share your code, and I will take a look?

r21gh commented 6 years ago

I tried to use cdn that mentioned @KrishnaPG <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pnotify/3.0.0/pnotify.min.js"></script>

and this script in index.html.

<script type="text/javascript">
            function init_PNotify() {
            if( typeof (PNotify) === 'undefined'){ return; }
            new PNotify({
              title: "PNotify",
              type: "info",
              text: "Welcome. Try hovering over me. You can click things behind me, because I'm non-blocking.",
              nonblock: {
                  nonblock: true
              },
              addclass: 'dark',
              styling: 'bootstrap3',
              hide: false,
              before_close: function(PNotify) {
                PNotify.update({
                  title: PNotify.options.title + " - Enjoy your Stay",
                  before_close: null
                });

                PNotify.queueRemove();

                return false;
              }
            });

            };
            init_PNotify();
</script>

it worked without error.