shipit icon indicating copy to clipboard operation
shipit copied to clipboard

deploy:fetch throwing error : TypeError: Cannot read property 'run' of undefined

Open VishalTaj opened this issue 3 years ago • 2 comments

Hi,

I am getting TypeError: Cannot read property 'run' of undefined error when i'm trying to deploy. please help me get a fix it. deployment was working fine suddenly i started getting this error.

cmd used: npx shipit staging deploy

Running 'deploy:init' task...
Finished 'deploy:init' after 453 μs
Running 'deploy:fetch' task...
Setup workspace...
/app/node_modules/shipit-cli/lib/Shipit.js:209
      return _this.pool.run(command, options);
                        ^

TypeError: Cannot read property 'run' of undefined
    at /app/node_modules/shipit-cli/lib/Shipit.js:209:25
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/app/node_modules/shipit-cli/lib/Shipit.js:18:103)
    at _next (/app/node_modules/shipit-cli/lib/Shipit.js:20:194)
    at /app/node_modules/shipit-cli/lib/Shipit.js:20:364
    at new Promise (<anonymous>)
    at /app/node_modules/shipit-cli/lib/Shipit.js:20:97
    at Shipit.remote (/app/node_modules/shipit-cli/lib/Shipit.js:210:7)
    at Shipit.<anonymous> (/app/shipitfile.js:34:14)
    at Shipit.emit (node:events:381:22)
    at Shipit.initialize (/app/node_modules/shipit-cli/lib/Shipit.js:100:10)
    at /app/node_modules/shipit-cli/lib/cli.js:89:14
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/app/node_modules/shipit-cli/lib/cli.js:19:103)
    at _next (/app/node_modules/shipit-cli/lib/cli.js:21:194)

below is my configuration:

shipitfile.js

module.exports = shipit => {
    require('shipit-deploy')(shipit);
    require('shipit-shared')(shipit);
    shipit.initConfig({
      default: {
        deployTo: '/var/www/example.com',
        keepReleases: 5,
        shared: {
          overwrite: true,
          dirs: ['node_modules'],
          files: ['.env']
        }
      },
      staging: {
        servers: '[email protected]',
        branch: 'staging'
      },
    });
    
        // Callbacks

    shipit.on('init', () => {
      shipit.remote(`set NODE_ENV=${shipit.environment}`);
    })
    shipit.on('updated', () => {
      shipit.start('npm-install');
    });
  
    shipit.on('published', () => {

      shipit.start('db:migrate');
      shipit.start('pm2-server');
    });

    // Tasks
    shipit.blTask('npm-install', async () => {
      shipit.remote(`cd ${shipit.releasePath} && npm install --${shipit.environment}`);
    });

    shipit.blTask('pm2-server', async () => {
      await shipit.remote(`pm2 delete -s ${appName} || :`);
      await shipit.remote(
        `pm2 start ${shipit.releasePath}/app.js --env ${shipit.environment} --watch true --name ${appName}`
      );
    });

    shipit.blTask('db:migrate', async () => {
      shipit.remote(`cd ${shipit.releasePath} && npx sequelize db:migrate --env ${shipit.environment}`);
    });

 }   

Please help me to sort this out thanks in advance.

VishalTaj avatar Mar 29 '21 11:03 VishalTaj

Hi @VishalTaj, I am facing the same problem. Did you get the solution to this?

agnipanda avatar Jul 11 '22 17:07 agnipanda

Hi @agnipanda , for me it was the issue with node , npm version. when i changed to correct version issue got fixed.

VishalTaj avatar Jul 13 '22 09:07 VishalTaj