I tried installing the Npm module named 'pdfkit'. it is getting installed and is showing in the node_modules folder also. But when i try importing the module by :
var pdfkit=require ('pdfkit');
then npm throws an error stating that could not resolve fs module.
It is working fine in other already installed modules in the project.
Npm version:- 3.3.12
Node v:- 5.4.0
Kindly help me on this.
You may need to install the "node-fs" module (npm install node-fs)
Otherwise, the location of the module folder may be the cause.
I just solved a similar problem on win8.
When installing pdfkit as described in the manual (npm install pdfkit), the modules got placed in a folder named "node_modules" in the current directory of the cmd line program.
In my case, this was "C:\Users\User\node_modules".
A simple "dir node_modules" command reveals the installed modules:
"file_saver", "node-fs", pdfkit", "requirejs".
My problem was that the "require 'pdf' node statement throws a "module not found error" when the script is in a folder which is not in the path of C:\Users.
In my case, the path of the script is "C:\somefolder\somefile.js".
To solve the problem, I installed a second set of node modules, this time in the "C:\" folder.
And voila: now it works.
A simple "dir C:\node_modules" command reveals the modules in the new location.