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

TypeError: ast.remove is not a function #501

Closed
thenewvu opened this issue Mar 3, 2017 · 23 comments
Closed

TypeError: ast.remove is not a function #501

thenewvu opened this issue Mar 3, 2017 · 23 comments
Milestone

Comments

@thenewvu
Copy link

thenewvu commented Mar 3, 2017

Sir, I've met this error with all CSS files and with both custom and default configure:

(node:25107) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: ast.remove is not a function
(node:25107) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

This error only occurs in v4.0.1, not with v3.1.7.

My environment:

node v7.7.1
arch linux 4.9.11
@sublistic
Copy link

I get the following similar error:

(node:2323) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'is' of null
(node:2323) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

node v7.10.0
OSX 10.11.6

@1f47a
Copy link

1f47a commented May 11, 2017

Same error here

node 7.10.0
OSX 10.10.5

@gabriensymons
Copy link

gabriensymons commented May 11, 2017

Similar error when running [email protected] as an exec command with ant. Like @thenewvu, no error with version 3.1.7:

csscomb:
     [exec] (node:66140) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: this._parseString(...).then is not a function

My env:

Apache Ant 1.9.7
node 6.10.2
macOS 10.12.4

@janwerkhoven
Copy link
Contributor

janwerkhoven commented Jun 2, 2017

Getting error in Atom Beautify 0.29.26 which uses CSS Comb. How to resolve?

TypeError: ast.remove is not a function
    at /Users/jw/.atom/packages/atom-beautify/node_modules/csscomb/lib/options/block-indent.js:48:13
    at Node.eachFor (/Users/jw/.atom/packages/atom-beautify/node_modules/gonzales-pe/lib/gonzales.js:129:83)
    at Object.process (/Users/jw/.atom/packages/atom-beautify/node_modules/csscomb/lib/options/block-indent.js:44:9)
    at /Users/jw/.atom/packages/atom-beautify/node_modules/csscomb/lib/core.js:380:14
    at Array.forEach (native)
    at Comb._processTree (/Users/jw/.atom/packages/atom-beautify/node_modules/csscomb/lib/core.js:379:8)

@janwerkhoven
Copy link
Contributor

janwerkhoven commented Jun 12, 2017

Temporary workaround: Remove "block-indent": " ", from the .csscomb.json file and the error ceases to appear and ceases to block the rest of the formatting. That means no indenting of blocks until fixed, but still better than no formatting at all.

@janwerkhoven
Copy link
Contributor

@janwerkhoven
Copy link
Contributor

Is nobody maintaining this?

@obenjiro
Copy link
Contributor

@janwerkhoven I do maintain this repository. I will look into this asap.

@obenjiro obenjiro added this to the 4.3.0 milestone Jun 27, 2017
@mfeckie
Copy link

mfeckie commented Jun 27, 2017

Should this

https://github.com/csscomb/csscomb.js/blob/dev/src/options/block-indent.js#L48

ast.remove(i);

not be

ast.removeChild(i); ?

@ryanbowden
Copy link

I am having the same issue and changing
"eof-newline": false,
to true fixes the fault. Hope that helps finding the issue.

@ikeq
Copy link

ikeq commented Aug 14, 2017

@ryanbowden It works! Thanks.

@Spunkie
Copy link

Spunkie commented Aug 14, 2017

The fix from @mfeckie worked for me.

@maxfenton
Copy link

Still having this issue in the current version until I make the change @ryanbowden suggested.

@tucq88
Copy link

tucq88 commented Oct 27, 2017

Still having issue, @ryanbowden update does'nt work with me :(

@tucq88
Copy link

tucq88 commented Oct 27, 2017

Found the issues, cause my style has many lines commented out by // , Is this a known issue ?

@janwerkhoven
Copy link
Contributor

janwerkhoven commented Oct 27, 2017

I can confirm both the fix and work-around.

How to avoid the errors

In the .csscomb.json set "eof-newline": true,.

Thanks @ryanbowden

How to fix it

In node_modules/csscomb/lib/options/block-indent.js replace ast.remove(i); with ast.removeChild(i);.

Thanks @mfeckie !

@seezee
Copy link

seezee commented Dec 8, 2017

Also getting similar error. Node v.8.9.1 & OS High Sierra with latest CSSComb. (node:22596) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): [object Object] (node:22596) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@harapeko
Copy link

harapeko commented Dec 13, 2017

similar error

.hoge {
    $arr: (
        "s": 3,
        "m": 4,
        "l": 5,
    ) !default;

    @each $key, $value in $arr {
        "&--of3" { // ← this is bad
        }
    }
}
(node:110565) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): [object Object]
(node:110565) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Node: v8.7.0
OS: Ubuntu 14.04.5 LTS

@klavatron
Copy link

Thanks, both fixes work!

@xianshenglu
Copy link

@ryanbowden ,It works for me too!

@luisFebro
Copy link

luisFebro commented Dec 20, 2018

*{
  outline: none;
}*

My issue was this last asterisk which was preventing my code to run. Check if you don't have such syntax error because I have tried all the solutions above, but ended up to be that!

UPDATED: watch out for unset comments, if you don't wrap them like this:

color: navy;
  background-color: black;
  _TOP:  
  1st top-left; 2nd top-right;
  BOTTOM:
  3rd bottom-right; 4th bottom-left;_ /*this whole block should be a comment block. This produces this error, too*/
  text-shadow: -3px -3px 7px lightblue, 3px -3px 7px lightblue,
  3px 3px 7px lightblue, -3px 3px 7px lightblue;

@tonyganch
Copy link
Member

Fixed by @janwerkhoven with #552.

@janwerkhoven
Copy link
Contributor

🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests