magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.57k stars 9.32k forks source link

grunt task less:blank fails #1732

Closed markshust closed 9 years ago

markshust commented 9 years ago

Command grunt less:blank fails:

root@29e2a8f1a7e3:/var/www/html# grunt less:blank
Running "less:blank" (less) task
>> FileError: '_actions-toolbar.less' wasn't found in pub/static/frontend/Magento/blank/en_US/css/source/lib/_lib.less on line 9, column 1:
>> 8 
>> 9 @import '_actions-toolbar.less';
>> 10 @import '_breadcrumbs.less';
Warning: Error compiling pub/static/frontend/Magento/blank/en_US/css/styles-m.less Use --force to continue.

Aborted due to warnings.

It appears this command is failing because pub/static/frontend/Magento/blank/en_US/css/source/lib/_lib.less is importing the following files:

@import '_actions-toolbar.less'; @import '_breadcrumbs.less'; @import '_buttons.less'; @import '_dropdowns.less'; @import '_forms.less'; @import '_grids.less'; @import '_icons.less'; @import '_layout.less'; @import '_loaders.less'; @import '_messages.less'; @import '_navigation.less'; @import '_pages.less'; @import '_popups.less'; @import '_rating.less'; @import '_resets.less'; @import '_sections.less'; @import '_tables.less'; @import '_tooltips.less'; @import '_typography.less'; @import '_utilities.less'; @import '_variables.less';

of which none exist in the pub/static/frontend/Magento/blank/en_US/css/source/lib/ folder.

Related, the pub/static/frontend/Magento/luma/en_US/css/source/lib/folder contains all these files and the grunt less:luma command executes successfully.

markshust commented 9 years ago

Related, the first time grunt refresh is ran, it fails because of the above. However, if grunt refresh is ran again, I receive the following output:

Running "less:blank" (less) task
File pub/static/frontend/Magento/blank/en_US/css/styles-m.css created: 220.67 kB → 381.21 kB
File pub/static/frontend/Magento/blank/en_US/css/styles-l.css created: 61.51 kB → 106.39 kB
File pub/static/frontend/Magento/blank/en_US/css/email.css created: 6.75 kB → 12.65 kB
File pub/static/frontend/Magento/blank/en_US/css/email-inline.css created: 9.74 kB → 18.15 kB

Running "less:luma" (less) task
File pub/static/frontend/Magento/luma/en_US/css/styles-m.css created: 260.99 kB → 449.23 kB
File pub/static/frontend/Magento/luma/en_US/css/styles-l.css created: 76.57 kB → 131.08 kB

Running "less:backend" (less) task
File pub/static/adminhtml/Magento/backend/en_US/css/styles-old.css created: 175.6 kB → 287.98 kB
File pub/static/adminhtml/Magento/backend/en_US/css/styles.css created: 240.88 kB → 399.17 kB

After which, grunt less:blank executes successfully.

I'm installing M2 with Docker using https://hub.docker.com/r/mageinferno/magento2-setup/ and afterwards using using https://hub.docker.com/r/mageinferno/magento2-php-apache/ for web serving. The setup script is at https://bitbucket.org/mageinferno/magento2-setup/src/00024308cf9bc04ed9cc2382ea0f56fc0e3f7bbe/magento2-setup?at=master -- as you can see, it finalizes with a grunt refresh command. However, the static assets needed to compile the less file don't seem to be generating through the setup script.

piotrekkaminski commented 9 years ago

Internal issue MAGETWO-43790

dciccale commented 9 years ago

same issue here. however even after running grunt refresh twice. now i have the following error:

Running "less:blank" (less) task
>> FileError: '_actions-toolbar.less' wasn't found in pub/static/frontend/Magento/blank/en_US/css/source/lib/_lib.less on line 9, column 1:
>> 8 
>> 9 @import '_actions-toolbar.less';
>> 10 @import '_breadcrumbs.less';
eug123 commented 9 years ago

Hi @dciccale, Please specify your system configuration, magento version and the way you are installing it.

dciccale commented 9 years ago

OSX 10.10.5

https://bitbucket.org/mageinferno/magento2-docker-compose

docker-compose up
markshust commented 9 years ago

Same setup I'm using :+1:

This is an automated build setup script on a debian:jessie kernel/os built on Docker. I don't think there is anything specific to this setup & build script that would be causing this not to generate on the first or second try.

The setup scripts and installer files can all be found at https://bitbucket.org/mageinferno/

dciccale commented 9 years ago

basically the only thing that fails here is the setup docker image, which run this setup script

i can't see anything wrong there. the less task is failing thus breaking the build of the image to be run by docker.

markshust commented 9 years ago

If you just run docker-compose up setup it should install fully up to the last line. then you can run docker-compose up -d app to get it going. I've found running a few commands against app instance get it to complete successfully (docker exec -it CONT_APP_ID grunt refresh), however there is no reason this should ever be failing.

dciccale commented 9 years ago

i've tried that. however is true that the grunt tak doesn't break the build. but something else does. will do more tests and see what's going on.

dciccale commented 9 years ago

couldn't get it working. will try something else thx

dciccale commented 9 years ago

@markoshust now i get this error An error has happened during application run. See exception log for details. Could not write error message to log. Please use developer mode to see the message.

the previous error with the less compilation was fixed now.

markshust commented 9 years ago

I'm now receiving this error on initial grunt refresh:

setup_1   | Running "less:blank" (less) task
setup_1   | >> FileError: 'source/_sources.less' wasn't found in pub/static/frontend/Magento/blank/en_US/css/_styles.less on line 4, column 1:
setup_1   | >> 3 @import 'source/lib/_lib.less'; // Global lib
setup_1   | >> 4 @import 'source/_sources.less'; // Theme styles
setup_1   | >> 5 @import 'source/_components.less'; // Components styles (modal/sliding panel)
setup_1   | Warning: Error compiling pub/static/frontend/Magento/blank/en_US/css/styles-m.less Use --force to continue.
setup_1   | 
setup_1   | Aborted due to warnings.

If I open up pub/static/frontend/Magento/blank/en_US/css/_styles.less, here are the contents:

@import 'source/lib/_lib.less'; // Global lib 
@import 'source/_sources.less'; // Theme styles
@import 'source/_components.less'; // Components styles (modal/sliding panel)

This appears correct. However, the file pub/static/frontend/Magento/blank/en_US/css/source/_sources.less doesn't exist.

This file exists: pub/static/frontend/Magento/blank/en_US/css/source/_sources.css, and here are the contents:

CSS compilation from LESS variable @baseDir is undefined in file /src/var/view_preprocessed/less/frontend/Magento/blank/en_US/css/source/_typography.less in _typography.less on line 8, column 17
06| .font-face(
07|     @family-name: @font-family-name__base,
08|     @font-path: '@{baseDir}fonts/opensans/light/opensans-300',
09|     @font-weight: 300,
10|     @font-style: normal
11| );

If I open up var/view_preprocessed/less/frontend/Magento/blank/en_US/css/source/_typography.less, here are the starting file contents:


.font-face(
    @family-name: @font-family-name__base,
    @font-path: '@{baseDir}fonts/opensans/light/opensans-300',
    @font-weight: 300,
    @font-style: normal
);

.font-face(
    @family-name: @font-family-name__base,
    @font-path: '@{baseDir}fonts/opensans/regular/opensans-400',
    @font-weight: 400,
    @font-style: normal
);

.font-face(
    @family-name: @font-family-name__base,
    @font-path: '@{baseDir}fonts/opensans/semibold/opensans-600',
    @font-weight: 600,
...

Something is happening during this build process which is causing these less files to not properly generate, or import files to not be properly defined. The fact that pub/static/frontend/Magento/blank/en_US/css/source/_sources.less is missing is telling me that somewhere the static frontend asset generation isn't working 100%.

markshust commented 9 years ago

Fresh install of Magento 2, immediately after running a grunt refresh:

setup_1   | Running "exec:all" (exec) task
setup_1   | grunt --force clean:blank
setup_1   | Gathering css/styles-m.less sources.
setup_1   | Successfully processed LESS and/or SASS files
setup_1   | Gathering css/styles-l.less sources.
setup_1   | Successfully processed LESS and/or SASS files
setup_1   | Gathering css/email.less sources.
setup_1   | Successfully processed LESS and/or SASS files
setup_1   | Gathering css/email-inline.less sources.
setup_1   | Successfully processed LESS and/or SASS files
setup_1   | Running "clean:luma" (clean) task
setup_1   | >> 14995 paths cleaned.
setup_1   | 
setup_1   | Done, without errors.
setup_1   | 
setup_1   | 
setup_1   | Execution Time (2015-10-24 04:20:22 UTC)
setup_1   | clean:luma     1m 4.5s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 99%
setup_1   | Total 1m 5.1s
setup_1   | 
setup_1   | Gathering css/styles-m.less sources.
setup_1   | Successfully processed LESS and/or SASS files
setup_1   | Gathering css/styles-l.less sources.
setup_1   | Successfully processed LESS and/or SASS files
setup_1   | Running "clean:backend" (clean) task
setup_1   | >> 3467 paths cleaned.
setup_1   | 
setup_1   | Done, without errors.
setup_1   | 
setup_1   | 
setup_1   | Execution Time (2015-10-24 04:21:42 UTC)
setup_1   | loading tasks  1.1s  ▇▇▇▇▇ 10%
setup_1   | clean:backend   10s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 90%
setup_1   | Total 11.1s
setup_1   | 
setup_1   | Gathering css/styles-old.less sources.
setup_1   | Successfully processed LESS and/or SASS files
setup_1   | Gathering css/styles.less sources.
setup_1   | Successfully processed LESS and/or SASS files
setup_1   | 
setup_1   | Running "less:blank" (less) task
setup_1   | >> FileError: 'source/_sources.less' wasn't found in pub/static/frontend/Magento/blank/en_US/css/_styles.less on line 4, column 1:
setup_1   | >> 3 @import 'source/lib/_lib.less'; // Global lib
setup_1   | >> 4 @import 'source/_sources.less'; // Theme styles
setup_1   | >> 5 @import 'source/_components.less'; // Components styles (modal/sliding panel)
setup_1   | Warning: Error compiling pub/static/frontend/Magento/blank/en_US/css/styles-m.less Use --force to continue.
setup_1   | 
setup_1   | Aborted due to warnings.
setup_1   | 
setup_1   | 
setup_1   | Execution Time (2015-10-24 04:20:14 UTC)
setup_1   | exec:all        1m 50.4s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 98%
setup_1   | Total 1m 52.2s
setup_1   | 

Fails. Run grunt refresh again immediately after the first grunt refresh:

setup_1   | Running "exec:all" (exec) task
setup_1   | grunt --force clean:blank
setup_1   | Gathering css/styles-m.less sources.
setup_1   | Successfully processed LESS and/or SASS files
setup_1   | Gathering css/styles-l.less sources.
setup_1   | Successfully processed LESS and/or SASS files
setup_1   | Gathering css/email.less sources.
setup_1   | Successfully processed LESS and/or SASS files
setup_1   | Gathering css/email-inline.less sources.
setup_1   | Successfully processed LESS and/or SASS files
setup_1   | Running "clean:luma" (clean) task
setup_1   | >> 1189 paths cleaned.
setup_1   | 
setup_1   | Done, without errors.
setup_1   | 
setup_1   | 
setup_1   | Execution Time (2015-10-24 04:25:22 UTC)
setup_1   | loading tasks  401ms  ▇▇▇▇▇▇ 12%
setup_1   | clean:luma        3s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 88%
setup_1   | Total 3.4s
setup_1   | 
setup_1   | Gathering css/styles-m.less sources.
setup_1   | Successfully processed LESS and/or SASS files
setup_1   | Gathering css/styles-l.less sources.
setup_1   | Successfully processed LESS and/or SASS files
setup_1   | Running "clean:backend" (clean) task
setup_1   | >> 989 paths cleaned.
setup_1   | 
setup_1   | Done, without errors.
setup_1   | 
setup_1   | 
setup_1   | Execution Time (2015-10-24 04:25:42 UTC)
setup_1   | loading tasks    3s  ▇▇▇▇▇▇▇▇▇▇▇▇▇ 27%
setup_1   | clean:backend  7.9s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 72%
setup_1   | Total 11s
setup_1   | 
setup_1   | Gathering css/styles-old.less sources.
setup_1   | Successfully processed LESS and/or SASS files
setup_1   | Gathering css/styles.less sources.
setup_1   | Successfully processed LESS and/or SASS files
setup_1   | 
setup_1   | Running "less:blank" (less) task
setup_1   | File pub/static/frontend/Magento/blank/en_US/css/styles-m.css created: 220.67 kB → 381.21 kB
setup_1   | File pub/static/frontend/Magento/blank/en_US/css/styles-l.css created: 61.51 kB → 106.39 kB
setup_1   | File pub/static/frontend/Magento/blank/en_US/css/email.css created: 6.75 kB → 12.65 kB
setup_1   | File pub/static/frontend/Magento/blank/en_US/css/email-inline.css created: 9.74 kB → 18.15 kB
setup_1   | 
setup_1   | Running "less:luma" (less) task
setup_1   | File pub/static/frontend/Magento/luma/en_US/css/styles-m.css created: 260.99 kB → 448.78 kB
setup_1   | File pub/static/frontend/Magento/luma/en_US/css/styles-l.css created: 76.57 kB → 131.08 kB
setup_1   | 
setup_1   | Running "less:backend" (less) task
setup_1   | File pub/static/adminhtml/Magento/backend/en_US/css/styles-old.css created: 175.6 kB → 287.98 kB
setup_1   | File pub/static/adminhtml/Magento/backend/en_US/css/styles.css created: 240.88 kB → 399.17 kB
setup_1   | 
setup_1   | Done, without errors.
setup_1   | 
setup_1   | 
setup_1   | Execution Time (2015-10-24 04:25:00 UTC)
setup_1   | exec:all       1m 13.1s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 60%
setup_1   | less:blank        14.7s  ▇▇▇▇▇▇ 12%
setup_1   | less:luma           17s  ▇▇▇▇▇▇▇ 14%
setup_1   | less:backend        16s  ▇▇▇▇▇▇▇ 13%
setup_1   | Total 2m 2.5s
setup_1   | 

Something appears to be messed up with the ordering of how grunt is building these files (something is out of order), as the second grunt refresh immediately after the first one executes successfully.

markshust commented 9 years ago

This is no longer happening for me on the develop branch, so it must have been fixed in another ticket over the last few days. Closing it out.

markshust commented 9 years ago

I'm reopening this ticket, this is still valid. Happening on merchant_beta branch (currently == 1.0.0-beta6)

screen shot 2015-10-30 at 4 29 25 pm

eug123 commented 9 years ago

@markoshust ,

https://github.com/mageinferno/docker-magento2-setup/blob/master/m2setup.sh Line:62 there is static content deploy command /src/bin/magento setup:static-content:deploy this tool is supposed to be used in production mode, in other modes static assets are published automatically. It tries to compile all .less files (fixed in develop branch), and fails on most of them (respective css files, contains less errors - i.e. pub/static/frontend/Magento/blank/en_US/css/source/_sources.css) as they are compiling out of general context.

grunt refresh command is for initial start to (work with styles|http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-topics/css_debug.html#grunt_commands) - it clears pub/static/ and gets all .less sources ready in pub/static/ for configured themes and then compiles css out of them via node.js less library. So sources are ready to be compiled after changes in .less files with grunt less:<themeName> command, or automatically with grunt watch.

So setup:static-content:deploy takes time to publish static content and then grunt refresh on the first step tries to empty pub/static - undoes result of running deployment tool

markshust commented 9 years ago

Thanks very much for the explanation, this is very helpful!