I am trying to implement local modules in my application
1.Project root folder i have created folder named test
with a file named index.js
module.exports = {
myFunction:function(){
console.log('ok');
}
}
2.Added the following in package.json
in the root folder
"dependencies": {
"test-module": "file:test"
}
3.When i try to import var module = require('test-module');
in app.js
i got this error
Cannot find module 'test-module'
you can provide a path to a local directory that contains a package
{
"name": "baz",
"dependencies": {
"bar": "file:../foo/bar"
}
}
and perform npm install -s or npm install --save reference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With