Skip to content


rebuild tries to build in the wrong directory #1872

wavded opened this Issue · 5 comments

2 participants


On my local machine my node-canvas module is at:


On my deployment machine it is at


After rsyncing my files to the deployment machine, and cding to the directory and running npm rebuild, it tries to build the files in /home/wavded/Projects/adn/node_modules/canvas/build, I would expect it to use /var/www/adn/node_modules/canvas/build

npm member

That's because canvas's build script doesn't do a clean before the configure/install.

Instead of this:

  "scripts": { "preinstall": "node-waf configure build" },

It should do this:

  "scripts": { "preinstall": "node-waf clean || (exit 0); node-waf configure build" },

(Which, by the way, is the default npm action if there's a wscript and no install/preinstall script is defined, so you could just delete the scripts bit.)

@isaacs isaacs closed this
npm member

As a workaround, you could exclude the build/ folder from the rsync, or delete it before running rebuild.


Thanks for the quick response @isaacs, I put a case in with node-canvas as well ( Automattic/node-canvas#134 ) but will do your workaround for now.

npm member

Reopening. I think maybe npm should handle this better.

@isaacs isaacs reopened this
@isaacs isaacs referenced this issue in Automattic/node-canvas

npm rebuild issue #134


yeah, just noticed pg module doesn't clean by default either, seems like it wouldn't be bad and probably desirable to have npm run a clean target first before build if it exists...

@isaacs isaacs added a commit that closed this issue
@isaacs isaacs Fix #1872 Clean on rebuild 1395630
@isaacs isaacs closed this in 1395630
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.