Failed to locate couchnode native binding

Well im working with Node.JS and Couchbase, trying to write an api for my future projects. I faced a problem and it was weird one, i have no idea how this happened but got a solution.

When i started this project i was in bus and trying to write some code while i was in a bad situation. I dont know how i did it but my application folder was like this:

app.js
node_modules

inside node_modules i had couchbase folder and its required libraries ext. When i try to run this app i got this error:
Failed to locate couchnode native binding

Interesthing isnt it? I searched many forums, they said you need to check node-gyp be sure its installed ext but couldnd find resolve till my friend said “you didnt install it right”.

Well here the solution:

create a package.json file and write couchbase to your dependencies part like this:

“dependencies”: {
                          “couchbase”:”>=1.2.0″
}

other parts are usual package.json file name, description ext. Before running this command remove your existing node_modules folder. Then run npm install command. It will reinstall dependencies and your problem will be solved. I have no idea how did i install it like that at the first place but if you do same here your answer.

Reinstall it.