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

Unexpected identifier #402

Closed
webian opened this issue Sep 25, 2021 · 8 comments
Closed

Unexpected identifier #402

webian opened this issue Sep 25, 2021 · 8 comments
Labels

Comments

@webian
Copy link

webian commented Sep 25, 2021

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?

@webian
Copy link
Author

webian commented Sep 25, 2021

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

@RyanZim
Copy link
Collaborator

RyanZim commented Sep 26, 2021

Only Unexpected identifier; no stack trace or anything?

@webian
Copy link
Author

webian commented Sep 26, 2021

Yes, only that.

@gerardcanal
Copy link

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).

@RyanZim
Copy link
Collaborator

RyanZim commented Sep 27, 2021

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

@gerardcanal
Copy link

gerardcanal commented Sep 27, 2021

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).

@webian
Copy link
Author

webian commented Sep 27, 2021

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.

@RyanZim
Copy link
Collaborator

RyanZim commented Sep 27, 2021

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
Labels
Projects
None yet
Development

No branches or pull requests

3 participants