3

After upgrade from v2.1.8 to v2.2.2, error is shown when i run Grunt exec

$ grunt exec Loading "Gruntfile.js" tasks...ERROR

Error: Cannot find file. Alias "themes" not set. Use "filesRouter.set" method to set it. at Object.get (/var/www/vhosts/default/dev/tools/grunt/tools/files-router.js:69:19) at Object. (/var/www/vhosts/default/dev/tools/grunt/configs/clean.js:8:47) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at module.exports (/var/www/vhosts/default/node_modules/load-grunt-config/lib/readfile.js:22:16)

7

Because in M2.2 there is a new grunt config file : grunt-config.json

http://devdocs.magento.com/guides/v2.2/frontend-dev-guide/tools/using_grunt.html

so we have to install it again, and update grunt-config.json

from "themes": "dev/tools/grunt/configs/local-themes"

To "themes": "dev/tools/grunt/configs/themes"

Also you may got this error "node-gyp: relocation error: node-gyp: symbol SSL_set_cert_cb, version libssl.so.10 not defined in file libssl.so.10 with link time reference"

Run

yum update openssl

Then execute

npm install npm update

1

Because in M2.2 there is a new grunt config file : grunt-config.json

http://devdocs.magento.com/guides/v2.2/frontend-dev-guide/tools/using_grunt.html

You should copy file "dev/tools/grunt/configs/themes.js" to "dev/tools/grunt/configs/local-themes.js", Then change the block "module.exports" to:

module.exports = {
    theme_name: {
        area: 'frontend',
        name: 'Magento/theme_name',
        locale: 'en_US',
        files: [
            'css/styles-m',
            'css/styles-l',
            'css/email',
            'css/email-inline'
        ],
        dsl: 'less'
    }
};

because:

The problem with using the default configuration files is that they can get overwritten during code updates, together with your changes in them. To avoid this, you can use custom configuration files. The ability to use custom configuration files is implemented by the file router mechanism added by Magento.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.