Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

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

Open
VishalTaj opened this issue Mar 29, 2021 · 2 comments

Comments

@VishalTaj
Copy link

VishalTaj commented Mar 29, 2021

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: 'username@xxx.xxx.xx.xx',
        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 VishalTaj reopened this Mar 29, 2021
@agnipanda
Copy link

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

@VishalTaj
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants