Reputation: 43
I have a web app that simplified structure looks like this.
.
├── app.js
├── native_modules
│ └── my_module_addon
│ ├── binding.gyp
│ ├── index.js
│ ├── node_modules
│ ├── package.json
│ ├── my_module_addon.cc
├── node_modules
├── package.json
I have developed native module addon and linked it. I'd like to install easily my native addon after fetching the project from repo just calling npm and then automatically calling node-gyp rebuild.
npm install
Well, my app package.json:
{
"name": "MyWebApp",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"body-parser": "~1.13.2",
"express": "~4.13.1",
"my_module_addon": "file:./native_modules/my_module_addon"
}
}
And my module package.json:
{
"name": "scs3reader_addon",
"version": "1.0.0",
"description": "My Awesome Addon",
"main": "index.js",
"scripts": {
"install": "node-gyp rebuild"
},
"license": "MIT",
"dependencies": {
"bindings": "^1.2.1",
"nan": "^2.2.0"
},
"gypfile": true
}
To link my native addon I add it to dependencies
"my_module_addon": "file:./native_modules/my_module_addon"
The problem appears when I call npm install on web app I have all my modules installed and node-gyp executed but have no idea why there is no build folder and output files for native addon.
> node-gyp rebuild
CXX(target) Release/obj.target/my_module_addon/my_module_addon.o
SOLINK_MODULE(target) Release/my_module_addon.node
[email protected] node_modules/my_module_addon
├── [email protected]
└── [email protected]
Upvotes: 3
Views: 247
Reputation: 2046
Do you have git repo for native module? If you do - try this dependency style
"my_module_addon": "git+ssh://[email protected]/~/repos/my_module_addon"
That should work properly with npm install
Upvotes: 2