I am trying to add this plugin to my app: https://www.npmjs.com/package/cordova-pdf-generator
I installed NPM as instructed in https://blog.teamtreehouse.com/install-node-js-npm-windows. Then opened command prompt window and went to my app's folder. later i ran below commands in command prompt "npm install cordova-pdf-generator".After that ran this: "cordova plugins add node_modules/cordova-pdf-generator"
While running cordova plugins add node_modules/cordova-pdf-generator i am getting cordova.js script error.Please help me!!
Thanks,
Raghu
Those instructions seem... odd. After installing npm, you should only need to make a call to:
cordova plugin add cordova-pdf-generator --save
This should install the plugin from npm to your app, and add a line to your config.xml
with the plugin info.
EDIT: thinking about the npm
stuff some more, it looks like the author did some weird stuff to archive it. So... here's one way to get the plugin working. You've probably already called:
npm install cordova-pdf-generator
So that means you should have a subdirectory of the current directory named node_modules
. The next steps you need to take:
Create a cordova project:
cordova create MyProject
Add the plugin to the project:
cd MyProject
cordova plugins add ../node_modules/cordova-pdf-generator
The creating of the project was needed for the plugin to be added to it. That step doesn't appear to be listed in the cordova-pdf-generator
project on npmjs.com.