Skip to content

Unexpected identifier #402

Description

@webian

Hi, I'm new to postcss and I have a problem with a grunt.js that, using postcss+autoprefixer should prefix css but it doesn't.

Trying to find out the cause I ended to simply run:
npm i -D postcss postcss-cli
and then:
npx postcss
and it returns only:
Unexpected identifier

Please, what could I do to better debug this issue?

Activity

  1. webian commented on Sep 25, 2021

    @webian
    Author

    More info:
    postcss@8.3.8
    postcss-cli@9.0.0

    uname -a
    Linux Acer 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

    npm -v
    6.14.4

  2. RyanZim commented on Sep 26, 2021

    @RyanZim
    Collaborator

    Only Unexpected identifier; no stack trace or anything?

  3. webian commented on Sep 26, 2021

    @webian
    Author

    Yes, only that.

  4. gerardcanal commented on Sep 27, 2021

    @gerardcanal

    I am getting the same error on a scheduled CI run:

    /usr/lib/node_modules/postcss-cli/index.js:3
    import fs from 'fs-extra'
           ^^
    
    SyntaxError: Unexpected identifier
        at Module._compile (internal/modules/cjs/loader.js:723:23)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
        at Module.load (internal/modules/cjs/loader.js:653:32)
        at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
        at Function.Module._load (internal/modules/cjs/loader.js:585:3)
        at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
        at startup (internal/bootstrap/node.js:283:19)
        at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
    Error: Process completed with exit code 1.
    

    It was running well last week so I understand this was introduced recently (#401 apparently). I am not sure if I'm missing dependencies, I tried to install the ESM package with no luck (but I don't have much experience with node).

  5. RyanZim commented on Sep 27, 2021

    @RyanZim
    Collaborator

    What Node version are you running (both of you)?

  6. gerardcanal commented on Sep 27, 2021

    @gerardcanal

    That was a good point, I was running node 10 and just realised the logs had a deprecation warning, I completely missed that one! It is fixed now (currently on version 14).

  7. webian commented on Sep 27, 2021

    @webian
    Author

    Thank you @gerardcanal for the idea. I was running node 10 (default for Ubuntu 20.04) and I updated it to 14 using NodeSource PPA and the problem is solved.

  8. RyanZim commented on Sep 27, 2021

    @RyanZim
    Collaborator

    Yep, postcss-cli v9 requires Node 12 or higher, otherwise, you will get this error.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions