Search code examples
apostrophe-cms

Issue in updating apostrophe version 2.67.0


I am trying to update the apostrophe version from 2.62.0 to 2.67.0.

I am getting below error:

Promise { TypeError: Cannot read property 'css' of undefined at /app/node_modules/apostrophe/lib/modules/apostrophe-assets/index.js:1085:18

While going into the file, I can see below code where error is occurred:

 return less.render(fs.readFileSync(src, 'utf8'), lessOptions, function(err, css) {
    if (err) {
      self.apos.utils.error('LESS CSS ERROR:');
      self.apos.utils.error(err);
    }
    css = css.css;
    if (self.apos.argv['sync-to-uploadfs']) {
      css = self.prefixCssUrlsWith(css, self.apos.attachments.uploadfs.getUrl() + '/assets/' + self.generation);
    } else if (self.apos.prefix) {
      css = self.prefixCssUrls(css);
    }
    return callback(err, css);
  });

Please suggest the solution for this.


Solution

  • It looks like you may have upgraded apostrophe improperly. If you were to update just that module but not its dependencies this would happen because you would have the wrong version of the less module.

    Please update your project simply by typing npm update. That should update not just Apostrophe but also its dependencies.

    If you continue to have trouble look at your package.json file and check whether you have set your own dependency on the less module, and an old version of it. You should not do that unless you have a specific need unrelated to Apostrophe, let Apostrophe load its own dependencies.