Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Undefined operation: "1.5 times .875rem" #611

Closed
sstikkel opened this issue Jun 15, 2017 · 8 comments
Closed

Error: Undefined operation: "1.5 times .875rem" #611

sstikkel opened this issue Jun 15, 2017 · 8 comments

Comments

@sstikkel
Copy link

I had to downgrade to gulp-sass 3.0.0. It's bug in libsass sass/libsass#2309. So it should solve this by upgrading libsass and node sass to the latest version.

@xzyfer
Copy link
Collaborator

xzyfer commented Mar 11, 2018

Closed by #666

@xzyfer xzyfer closed this as completed Mar 11, 2018
@sovanyio
Copy link

Still getting this on 3.2.0

Error in plugin 'sass'
Message:
    file.scss
Error: Undefined operation: "3 times 0.375em".
        on line 18 of file.scss
        from line 15 of other-file.scss
>>   padding-left: 3 * $s-units--base-spacing;

   ----------------^

Works on 2.3.2

@JanikWeb
Copy link

Same here:

Error: Undefined operation: "2 times 1sqrt(5)/2".Error: Undefined operation: "2 times 1sqrt(5)/2".

@xzyfer
Copy link
Collaborator

xzyfer commented Mar 22, 2018 via email

@sovanyio
Copy link

sovanyio commented Mar 22, 2018

@JanikWeb are you using interpolation? Found out that arithmetic doesn't work against interpolated strings.

@ryyy20
Copy link

ryyy20 commented Apr 6, 2018

@sovanyio does that mean you can't do something like this:

$font-size-base: rems(18) !default; // Assumes the browser default, typically 16px ///////// $font-size-lg: $font-size-base * 1.25 !default;

cause I get the same error: Undefined operation: 'rems(18) times 1.25'
using node-sass@4.8.3

@cartbeforehorse
Copy link

cartbeforehorse commented Jun 19, 2018

From what I've discovered, it depends on what rems() does, and how it does it.
If it returns: #{calculated-rem}rem;, (which I've seen in some solutions), then further calculations are not possible, because the returned value is seen by the compiler as being a string (which you can't do math on).
If it returns: ($size-px / 16px) * 1rem;, then further calculations are possible because the returned value is a calculable number.

@nachtfunke
Copy link

From what I've discovered, it depends on what rems() does, and how it does it.
If it returns: #{calculated-rem}rem;, (which I've seen in some solutions), then further calculations are not possible, because the returned value is seen by the compiler as being a string (which you can't do math on).
If it returns: ($size-px / 16px) * 1rem;, then further calculations are possible because the returned value is a calculable number.

Thank you very much, this was the solution that I needed! @cartbeforehorse

dmnyk added a commit to dmnyk/eightshift-frontend-libs that referenced this issue Sep 3, 2021
When doing `npm run build` on one of the projects I am getting an error:

> SassError: Undefined operation "-1 * 0.5555555556em".
> margin: 0 (-1 * map-get-strict($the-posts, 'gutter'));

The problem seems to lie inside the `em() `function which returns interpolated value. The thing is that arithmetics don't perform well when handling interpolated strings. See dlmanning/gulp-sass#611 (comment)

```
@function em($pixels, $context: $browser-context) {
	@return #{math.div(strip-unit($pixels), strip-unit($context))}em;
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants