Closed marshallcool closed 6 years ago
Running into the same problem here.
Where ?
bootstrap's 4.0.0 beta 3 came out today. Might have to downgrade to their beta 2 again to make it work. I am running into the same issue.
@bryan-pegg23 Thanks. Bootstrap was a problem in my case.
The issue seems to be caused by this section of bootstrap's package.json
file
"browserslist": [
"last 1 major version",
">= 1%",
"Chrome >= 45",
"Firefox >= 38",
"Edge >= 12",
"Explorer >= 10",
"iOS >= 9",
"Safari >= 9",
"Android >= 4.4",
"Opera >= 30"
],
The autoprefixer
plugin uses this list and unless you have a version 7.0 or higher it does not support the last n major version
syntax.
Upgrading autoprefixer
should fix the issue.
ERROR in ./node_modules/css-loader?{"sourceMap":false,"importLoaders":1}!./node_modules/postcss-loader?{"ident":"postcss"}!./node_modules/bootstrap/dist/css/bootstrap.min.css Module build failed: BrowserslistError: Unknown browser major
Same error, just started happening.
Autoprefixer is at 6.7.7 Boostrap 4.0.0 beta.2
package.json
{
"name": "apm",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve -o --port 3913",
"build": "ng build",
"test": "ng test",
"lint": "ng lint --type-check",
"e2e": "ng e2e",
"build-prod": "ng build --prod --aot"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.0.0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
"@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.8",
"angular-dual-listbox": "^4.4.0",
"bootstrap": "^4.0.0-beta.2",
"core-js": "^2.4.1",
"font-awesome": "^4.7.0",
"jquery": "^1.9.1",
"ng2-select": "^2.0.0",
"ngx-progressbar": "^2.1.1",
"ngx-toastr": "^6.5.0",
"popper.js": "^1.12.3",
"rxjs": "^5.4.1",
"underscore": "^1.8.3",
"zone.js": "^0.8.14"
},
"devDependencies": {
"@angular/cli": "1.5.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/language-service": "^5.0.0",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/jquery": "^3.2.15",
"@types/node": "~6.0.60",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.0.4",
"tslint": "~5.3.2",
"typescript": "~2.4.2"
}
}
package-lock.json
"autoprefixer": {
"version": "6.7.7",
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-6.7.7.tgz",
"integrity": "sha1-Hb0cg1ZY41zj+ZhAmdsAWFx4IBQ=",
"dev": true
},
"bootstrap": {
"version": "4.0.0-beta.2",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.0.0-beta.2.tgz",
"integrity": "sha512-DzGtdTlKbrMoGMpz0LigKSqJ+MgtFKxA791PU/q062OlRG0HybNZcTLH7rpDAmLS66Y3esN9yzKHLLbqa5UR3w=="
},
"postcss-loader": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-1.3.3.tgz",
"integrity": "sha1-piHqH6KQYqg5cqRvVEhncTAZFus=",
"dev": true
},
@ekwebster "bootstrap": "^4.0.0-beta.2"
the caret here means it will update you to the most recent version, just try yarn upgrade bootstrap@4.0.0-beta.2
or npm update bootstrap@4.0.0-beta.2
I have the same error
Running into this issue as well trying to use the latest angular-cli "1.6.3" with the latest bootstrap "4.0.0-beta.2".
Did you tried this? Same error and fixed by,
Removing the caret ‘^’ did solve the problem
I have the same issue instead i am getting warning.
WARNING in ./node_modules/css-loader?{"sourceMap":false,"importLoaders":1}!./node_modules/postcss-loader/lib?{"ident":"postcss","sourceMap":false}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":fal se,"precision":8,"includePaths":[]}!./src/style-sheets/theme/theme.scss (Emitted value instead of an instance of Error) postcss-custom-properties: C:\Users\krishna.chandra\Desktop\retail\ng-ui\src\style-sheets\theme\theme.scss:456:5: variable '--globalSub2' is undefined and u sed without a fallback NonErrorEmittedError: (Emitted value instead of an instance of Error) postcss-custom-properties: C:\Users\krishna.chandra\Desktop\retail\ng-ui\src\style-sheets\theme\theme.scss:456:5: variable '--globalSu b2' is undefined and used without a fallback at Object.emitWarning (C:\Users\krishna.chandra\Desktop\retail\ng-ui\node_modules\webpack\lib\NormalModule.js:117:16) at result.warnings.forEach (C:\Users\krishna.chandra\Desktop\retail\ng-ui\node_modules\postcss-loader\lib\index.js:149:49) at Array.forEach (native) at postcss.process.then (C:\Users\krishna.chandra\Desktop\retail\ng-ui\node_modules\postcss-loader\lib\index.js:149:27) @ ./src/style-sheets/theme/theme.scss 4:14-208 @ multi ./node_modules/bootstrap/dist/css/bootstrap.min.css ./node_modules/primeng/resources/themes/omega/theme.css ./node_modules/primeng/resources/primeng.min.css ./src/style-sheets/theme/theme.scss ./ node_modules/font-awesome/css/font-awesome.css "4.0.0-beta.2" did not worked in my scenario.
This does seem to be related to bootstrap@4.0.0-beta.3
, and is also causing failures in our CI (https://travis-ci.org/angular/angular-cli/jobs/322676874).
I was facing same issue. I downgraded bootstrap with following steps. Uninstall bootstrap@4.0.0-beta.3: npm uninstall bootstrap --save Then installed bootstrap@4.0.0-beta.2: npm install bootstrap@4.0.0-beta.2 --save
I did not remove ^ because package-lock.json will handle it.
same problem here - on two different laptops. Why is beta.3 still up on their site ?
I have fixed my package.json to:
"bootstrap": "4.0.0-beta.2" If you have an app at production environment I think the best practice is to use a stable and fixed version.
Steps:
1-Remove /node_modules 2-Fix the package.json file 3-Execute npm install 4-Enjoy!
I downgraded bootstrap to "bootstrap@4.0.0-beta.2" and the app back to work again
I'm also facing the same problem ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader?{"ident":"postcss"}!./~/bootstrap/dist/css/bootstrap.min.css
@ ./~/bootstrap/dist/css/bootstrap.min.css 4:14-127 @ multi ./~/bootstrap/dist/css/bootstrap.min.css webpack: Failed to compile.
still happening - also today had to specify beta 2 as 3 will produce same error as above
A workaround here on SO (https://stackoverflow.com/questions/48034051/bootstrap-4-beta-3-throws-error-with-angular-cli). Will need to re-run each time you upgrade, until the next version of CLI that updates autoprefixer to latest...
This should be fixed on Angular CLIs side in the next release (1.6.4
). That should be next week.
Thanks you, for the moment I copy manually the files of bootstrap beta 3 for beta 2 in my project "proy\node_modules\bootstrap\dist\css" and It could render normally Because I need use some styles that beta 2 do not has.
I changed the path to bootstrap.scss @import "~ bootstrap / scss / bootstrap.scss"; in the styles.scss file. And solved this problem Also adding packages node-sass and sass-loader
I have the same problem too.
Same problem here and @Domer79 's solution does not work, the angular CLI shows the same error
You can use Bootstrap 4 beta 3, but first edit package.json in node_modules/bootstrap:
"browserslist": [ "last 1 major version", <----- delete this line ">= 1%", <----- delete this line "Chrome >= 45", "Firefox >= 38", "Edge >= 12", "Explorer >= 10", "iOS >= 9", "Safari >= 9", "Android >= 4.4", "Opera >= 30" ],
@jameskentTX provided me with the workaround. Except the filename is package.json in the node_modules/bootstrap folder for me.
Hi!
I upgraded to release 1.6.4
, but i'm always facing the problem, using bootstrap@4.0.0-beta.3
.
Unfortunately I need to use that version of bootstrap because it fixes another problem.
I'll try the workaround proposed some days ago, but I hope in a "cleaner" solution.
Thank you for the support.
CLI 1.6.4 does not fix the problem.
CLI 1.6.4 fixed the problem for me.
The error persist only in production builds.
Temp Fix
Should work
CLI 1.6.4 does not fix the issue !! But after applying workaround by @jameskentTX its working. Since we wanted the beta 3 build of bootstrap in our project we have to use this workaround till Angular CLI fixes the issue.
You must combine @megafy and @jameskentTX solution
Can you try @angular/cli@1.7.0-beta.0
instead please? See https://github.com/angular/angular-cli/issues/9029#issuecomment-357267439 for more details.
@filipesilva Yes using @angular/cli@1.7.0-beta.0
fix the issue.
Even i am facing the same issue.
package.json { ... ...
"ngx-bootstrap": "^1.9.3", ... ... }
package-lock.json { ... "autoprefixer": "6.7.7", ... }
not able to resolve it. Any help
I have @angular/cli@1.7.0-beta.0
but this problem has not disappeared. I noticed that problems arise inside src/styles.css
and with @import '~any/lib/here.css';
. That is, not depending on the library, if it is imported in this way. The main thing is that in the beginning there was a tilda.
/* This not works */
@import '~highlight.js/styles/default.css';
@import '~highlight.js/styles/googlecode.css';
@import '~font-awesome/css/font-awesome.min.css';
@import '~katex/dist/katex.min.css';
/* This works */
@import 'assets/css/angular.css';
@import 'assets/css/blog.css';
Hit same issues defined above using cli 1.6.5 whilst trying to perform a production build.
Temp fix suggested by @jameskentTX above allowed production build to run.
I upgraded to @angular/cli@1.7.0-beta.1
, created a new project, added bootstrap@^4.0.0
and I was able to start the app with bootstrap.min.css
plumbed in by adding it as an @import
to my styles.css
. I was also able to start my app by plumbing it in via the .angular-cli.json
by adding it to the styles.
A gotcha here would be to make sure you upgrade your global and your app to @angular/cli to 1.7.0-beta.1 and double check that it actually upgraded by running ng --version (mine didn't so I had to manually remove and reinstall it for some reason).
I had the same problem. this is because 4.0.0-beta.3 .please downgrade it to 4.0.0-beta.2 Detailed steps: In you pakage.json "bootstrap": "^4.0.0-beta.2" replace it with "bootstrap": "4.0.0-beta.2" ( remove the carrot sign) npm uninstall npm install This must fix it.
Just upgrade from 4.0.0-beta to 4.0.0 and experienced this problem with ng serve. Went back to 4.0.0-beta and ng serve is ok. This issue shouldn't be closed if it's a cli issue.
Simply upgrading to @angular/cli@1.7.0-beta.1 solved the problem for me, like @Jimeh87 proposed.
@dduft But were we not informed ng cli 1.6.4+ would fix this issue, and on 1.6.4, I remember it was fixed.
Now on 1.6.5 and issue rears its ugly head. Is the CLI retrogressing?
@pranaysand The idea to downgrade doesn't ring well in my ears. On 1.6.3, it couldn't work with bootstrap 4.0.0-beta.3, so it had to be downgraded to work.
Now, on 1.6.5, to work, we need to downgrade to a beta of bootstrap?
Development builds were fixed. Production builds required additional changes which were already present but are only available in 1.7 (currently in beta). The stylesheet optimization pipeline was rewritten providing both increased performance and fixing multiple underlying issues. This however cannot be published in a patch release hence its presence in 1.7 and not 1.6.x.
cli 1.7.0-beta.1 fixes the issue when using the latest released bootstrap (4.0.0) (not beta) as well.
Just globally update your angular/cli before starting a new project: npm i -g @angular/cli It works with beta 3, too !
Hi all! I read all of yours comment and after I follow most of logs that the npm leave on my console (after a boring fight with bootstrap), so I uninstall and reinstall: npm uninstall bootstrap --save subsequently npm install bootstrap@4.0.0-beta.2 --save so I see in the console: this warning:
npm WARN bootstrap@4.0.0-beta.2 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer depe ndencies yourself. npm WARN bootstrap@4.0.0-beta.2 requires a peer of popper.js@^1.12.3 but none is installed. You must install peer dep endencies yourself.
I follow the suggest, so npm install jquery@1.9.1 --save and npm install popper.js@^1.12.3 --save finally: npm install and ng serve and IT WORK!!!
It's work.Thanks
I just deleted the node_modules folder and put the packages back
macOs Node 8 node: 8 "@angular/common": "^5.0.0", "@angular/compiler": "^5.0.0", "@angular/compiler-cli": "^5.0.0", "@angular/core": "^5.0.0", "@angular/forms": "^5.0.0", "@angular/http": "^5.0.0", "@angular/cli": "^1.5.0", "@angular/compiler-cli": "^5.0.0",
Error:
ERROR in ./node_modules/css-loader?{"sourceMap":false,"importLoaders":1}!./node_modules/postcss-loader/lib?{"ident":"postcss","sourceMap":false}!./node_modules/bootstrap/dist/css/bootstrap.min.css Module build failed: BrowserslistError: Unknown browser major at error (/Users/aleksandrgusev/Documents/express_client/node_modules/browserslist/index.js:37:11) at Function.browserslist.checkName (/Users/aleksandrgusev/Documents/express_client/node_modules/browserslist/index.js:320:18) at Function.select (/Users/aleksandrgusev/Documents/express_client/node_modules/browserslist/index.js:438:37) at /Users/aleksandrgusev/Documents/express_client/node_modules/browserslist/index.js:207:41 at Array.forEach (native) at browserslist (/Users/aleksandrgusev/Documents/express_client/node_modules/browserslist/index.js:196:13) at Browsers.parse (/Users/aleksandrgusev/Documents/express_client/node_modules/autoprefixer/lib/browsers.js:44:14) at new Browsers (/Users/aleksandrgusev/Documents/express_client/node_modules/autoprefixer/lib/browsers.js:39:28) at loadPrefixes (/Users/aleksandrgusev/Documents/express_client/node_modules/autoprefixer/lib/autoprefixer.js:56:18) at plugin (/Users/aleksandrgusev/Documents/express_client/node_modules/autoprefixer/lib/autoprefixer.js:62:18) at LazyResult.run (/Users/aleksandrgusev/Documents/express_client/node_modules/postcss-loader/node_modules/postcss/lib/lazy-result.js:270:20) at LazyResult.asyncTick (/Users/aleksandrgusev/Documents/express_client/node_modules/postcss-loader/node_modules/postcss/lib/lazy-result.js:185:32) at LazyResult.asyncTick (/Users/aleksandrgusev/Documents/express_client/node_modules/postcss-loader/node_modules/postcss/lib/lazy-result.js:197:22) at LazyResult.asyncTick (/Users/aleksandrgusev/Documents/express_client/node_modules/postcss-loader/node_modules/postcss/lib/lazy-result.js:197:22) at processing.Promise.then._this2.processed (/Users/aleksandrgusev/Documents/express_client/node_modules/postcss-loader/node_modules/postcss/lib/lazy-result.js:224:20) at LazyResult.async (/Users/aleksandrgusev/Documents/express_client/node_modules/postcss-loader/node_modules/postcss/lib/lazy-result.js:221:27) @ ./node_modules/bootstrap/dist/css/bootstrap.min.css 4:14-131 @ multi ./src/styles.scss ./src/select.css ./node_modules/bootstrap/dist/css/bootstrap.min.css ./node_modules/font-awesome/css/font-awesome.min.css ./node_modules/primeng/resources/primeng.min.css ./node_modules/primeng/resources/themes/omega/theme.css ./node_modules/material-design-icons/iconfont/material-icons.css