I try to create a node module and make a postinstall script (into package.json) who copy a js file into the current project like this :
fs.copy(appDir + "/schedule.js", appDir + "/../../config/schedule.js", function (err)
{
if (err)
{
console.log(err);
}
else
{
fs.chmod(appDir + "/../../config/schedule.js", 0755, function (err, succ)
{
console.log(err, succ);
});
console.log("done write schedule.js base config");
}
});
The problem is the file correctly copy but it's lock and can't be edited... Chmod doesn't return error. I'm under max OS X with node js 0.10.33 (IDE IntelliJ)
Found it :) if the module is install like this :
sudo npm install mymodule
The file is not editable but if module is install without sudo everything is fine
npm install mymodule