ember-cli-deploy / ember-cli-deploy-revision-data

An ember-cli-plugin to create a unique revision key for the build
MIT License
21 stars 58 forks source link

Cannot find module './lib/scm-data-generators' #68

Closed belgoros closed 3 years ago

belgoros commented 6 years ago

I got the above error when running ember deploy build command. Here is the full stack trace:

Error: Cannot find module './lib/scm-data-generators'
Error: Cannot find module './lib/scm-data-generators'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.Module._load (module.js:466:25)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.scm (/Users/Serguei/projects/decastore/decastore-front/config/deploy.js:13:14)
    at Class.readConfig (/Users/Serguei/projects/decastore/decastore-front/node_modules/ember-cli-deploy-plugin/index.js:63:30)
    at Class._getScmData (/Users/Serguei/projects/decastore/decastore-front/node_modules/ember-cli-deploy-revision-data/index.js:63:37)
    at Class.prepare (/Users/Serguei/projects/decastore/decastore-front/node_modules/ember-cli-deploy-revision-data/index.js:37:23)
    at Object.fn (/Users/Serguei/projects/decastore/decastore-front/node_modules/ember-cli-deploy/lib/tasks/pipeline.js:93:21)
    at Pipeline._notifyPipelinePluginHookExecution (/Users/Serguei/projects/decastore/decastore-front/node_modules/ember-cli-deploy/lib/models/pipeline.js:173:19)
    at tryCatch (/Users/Serguei/projects/decastore/decastore-front/node_modules/rsvp/dist/rsvp.js:525:12)
    at invokeCallback (/Users/Serguei/projects/decastore/decastore-front/node_modules/rsvp/dist/rsvp.js:538:13)
    at /Users/Serguei/projects/decastore/decastore-front/node_modules/rsvp/dist/rsvp.js:606:14
    at flush (/Users/Serguei/projects/decastore/decastore-front/node_modules/rsvp/dist/rsvp.js:2415:5)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
Pipeline aborted

Here is deploy.js file:

/* eslint-env node */
'use strict';

module.exports = function(deployTarget) {
  let ENV = {
    build: {}
    // include other plugin configuration that applies to all deploy targets here
  };

  ENV["revision-data"] = {
    type: 'version-commit',
    scm: function(context) {
      return require('./lib/scm-data-generators')['git'];
    }
  }

  if (deployTarget === 'development') {
    ENV.build.environment = 'development';
    ENV.outputPath = 'dist';

    // configure other plugins for development deploy target here
  }

  if (deployTarget === 'production') {
    ENV.build.environment = 'production';
    // configure other plugins for production deploy target here
  }

  // Note: if you need to build some configuration asynchronously, you can return
  // a promise that resolves with the ENV object instead of returning the
  // ENV object synchronously.
  return ENV;
};

The folder it can't find is present in node_modules directory of the Ember app:

screen shot 2018-05-23 at 17 08 17

What's wrong here ? Thank you. My settings:

ember-cli: 3.1.4
node: 8.9.1
os: darwin x64
"ember-cli-deploy-revision-data": "^1.0.0",
ahemed-haneen commented 3 years ago

did you obtain any fix for this? @belgoros

belgoros commented 3 years ago

@TheLooseCannon I can't remember exactly the trick I used, but here is the latest version of deploy.js, hope this helps:

/* eslint-env node */
'use strict';

module.exports = function(deployTarget) {

  let ENV = {
    build: {
      environment: deployTarget,
      outputPath: 'dist'
    }
    // include other plugin configuration that applies to all deploy targets here
  };

  ENV["revision-data"] = {
    type: 'version-commit'
  }

  if (deployTarget === 'staging') {
    ENV.s3 = {
      accessKeyId: process.env.AWS_ACCESS_KEY,
      secretAccessKey: process.env.AWS_SECRET_KEY,
      bucket: process.env.AWS_BUCKET_NAME,
      region: 'eu-west-1',
      allowOverwrite: true,
      acl: 'private'
    };

    ENV['s3-index'] = {
      accessKeyId: process.env.AWS_ACCESS_KEY,
      secretAccessKey: process.env.AWS_SECRET_KEY,
      bucket: process.env.AWS_BUCKET_NAME,
      region: 'eu-west-1',
      allowOverwrite: true,
      acl: 'private'
    };

    ENV.cloudfront = {
      accessKeyId: process.env.AWS_ACCESS_KEY,
      secretAccessKey: process.env.AWS_SECRET_KEY,
      distribution: process.env.AWS_DISTRIBUTION_ID,
      region: 'eu-west-1'
    }
  }

  if (deployTarget === 'production') {
    // put the production values here
  }

  // Note: if you need to build some configuration asynchronously, you can return
  // a promise that resolves with the ENV object instead of returning the
  // ENV object synchronously.
  return ENV;
};