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

npm script fails with "SyntaxError: Cannot use import statement outside a module" #35619

Closed
3 tasks done
uluhonolulu opened this issue Dec 29, 2021 · 3 comments
Closed
3 tasks done

Comments

@uluhonolulu
Copy link

Prerequisites

Describe the issue

I'm trying to run npm run css-prefix-main from the root of the cloned repository (tried both the main branch and the v4.3.1 tag). I'm consistently getting "SyntaxError: Cannot use import statement outside a module".

Here's the full output:

$ npm run css-prefix-main 

> bootstrap@5.1.3 css-prefix-main C:\Emr\Tools\bootstrap
> postcss --config build/postcss.config.js --replace "dist/css/*.css" "!dist/css/*.rtl*.css" "!dist/css/*.min.css"

C:\Emr\Tools\bootstrap\node_modules\postcss-cli\index.js:3
import fs from 'fs-extra'
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at Module._compile (internal/modules/cjs/loader.js:895:18)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
    at internal/main/run_main_module.js:17:11
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bootstrap@5.1.3 css-prefix-main: `postcss --config build/postcss.config.js --replace "dist/css/*.css" "!dist/css/*.rtl*.css" "!dist/css/*.min.css"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bootstrap@5.1.3 css-prefix-main script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\uluho\AppData\Roaming\npm-cache\_logs\2021-12-29T08_53_13_023Z-debug.log

Reduced test cases

No test case, just clone the repo and run the command.

What operating system(s) are you seeing the problem on?

Windows

What browser(s) are you seeing the problem on?

No response

What version of Bootstrap are you using?

v5.1.3

@ffoodd
Copy link
Member

ffoodd commented Dec 29, 2021

Please check your node & npm version, this doesn't seem like something on our end since our CI builds.

FYI we're currently using node 16, if I recall correctly.

@uluhonolulu
Copy link
Author

Weird, I have node v12, it's supposed to support ES6 modules. Anyway, after digging a bit more, I believe it's actually a postcss issue, closing.

@movy
Copy link

movy commented Jun 8, 2022

might help: postcss/postcss-cli#387

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

3 participants