Search code examples
npmdeploymentnode-modulesnpm-installphp-deployer

Deployer doesn't pick up cached binaries


Deployer: 6.4.6 OS: Ubuntu 18.04 LTS npm: 5.6.0 node: 8.11.4

Hello, when deploying with deployer my npm install takes 157s, but when I tried to recreate that step when ssh'ed (with the same user) it took 13~s when node_modules are in place, when not(30s) and during deployer's npm install I have the node_modules present. it seems that the issue is some kind of cache not working when using deployer.

when doing manually:

npm install

> [email protected] install /var/www/site/releases/4/node_modules/node-sass
> node scripts/install.js

Cached binary found at /home/deployer/.npm/node-sass/4.8.3/linux-x64-57_binding.node

when using deployer:

➤ Executing task npm:install

[dev] > cp -R /var/www/site/releases/6/node_modules /var/www/site/releases/7/node_modules
[dev] > cd /var/www/site/releases/7 && npm install
[dev] < > [email protected] install /var/www/site/releases/7/node_modules/node-sass
[dev] < > node scripts/install.js
[dev] < Downloading binary from https://github.com/sass/node-sass/releases/download/v4.8.3/linux-x64-67_binding.node
[dev] < Cannot download "https://github.com/sass/node-sass/releases/download/v4.8.3/linux-x64-67_binding.node": 
[dev] < HTTP error 404 Not Found
[dev] < Hint: If github.com is not accessible in your location
[dev] <       try setting a proxy via HTTP_PROXY, e.g. 
[dev] <       export HTTP_PROXY=http://example.com:1234
[dev] < or configure npm proxy via
[dev] <       npm config set proxy http://example.com:8080

when doing manually it picks up the cached binary and when doing via deployer it doesn't - not sure why this happens - is it possible am I missing some environment variables when deploying with deployer?


Solution

  • So what resolved my issue in the end was updating my laravel-mix dependency which uses a newer node-sass dependency which doesn't fail to download the binary and in the end the npm install process got a lot faster.