Closed zaalbarxx closed 6 years ago
I think this is related to https://github.com/angular/angular/issues/20676
@jameslafferty I'm not sure this is entirely related, as I had zero issues with importing the Material Design Icons until the most recent angular-cli version.
@import '../../node_modules/material-design-icons/iconfont/material-icons.css';
The issue seems to be that the new postcss-import
just chucks the imported CSS file inside of the one importing it, without resolving relative paths.
As a temporary quick fix, you can simply copy the font files to your project's local styles folder.
Not limite to Window or sass. Using the directions to import the style sheets for Material results in a broken build:
in styles.css:
@import '~@angular/material/prebuilt-themes/deeppurple-amber.css';
results in:
ERROR in ./node_modules/css-loader?{"sourceMap":false,"import":false}!./node_modules/postcss-loader/lib?{"ident":"postcss","sourceMap":false}!./src/styles.css
Module build failed: Error: Can't resolve '~@angular/material/prebuilt-themes/deeppurple-amber.css' in '/Users/john/Dev/Javascript/Angular/timetracker/src'
at onError (/Users/john/Dev/Javascript/Angular/timetracker/node_modules/enhanced-resolve/lib/Resolver.js:61:15)
at loggingCallbackWrapper (/Users/john/Dev/Javascript/Angular/timetracker/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at runAfter (/Users/john/Dev/Javascript/Angular/timetracker/node_modules/enhanced-resolve/lib/Resolver.js:158:4)
at innerCallback (/Users/john/Dev/Javascript/Angular/timetracker/node_modules/enhanced-resolve/lib/Resolver.js:146:3)
at loggingCallbackWrapper (/Users/john/Dev/Javascript/Angular/timetracker/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at next (/Users/john/Dev/Javascript/Angular/timetracker/node_modules/tapable/lib/Tapable.js:252:11)
at /Users/john/Dev/Javascript/Angular/timetracker/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:40:4
at loggingCallbackWrapper (/Users/john/Dev/Javascript/Angular/timetracker/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at runAfter (/Users/john/Dev/Javascript/Angular/timetracker/node_modules/enhanced-resolve/lib/Resolver.js:158:4)
at innerCallback (/Users/john/Dev/Javascript/Angular/timetracker/node_modules/enhanced-resolve/lib/Resolver.js:146:3)
at loggingCallbackWrapper (/Users/john/Dev/Javascript/Angular/timetracker/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at next (/Users/john/Dev/Javascript/Angular/timetracker/node_modules/tapable/lib/Tapable.js:252:11)
at innerCallback (/Users/john/Dev/Javascript/Angular/timetracker/node_modules/enhanced-resolve/lib/Resolver.js:144:11)
at loggingCallbackWrapper (/Users/john/Dev/Javascript/Angular/timetracker/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at next (/Users/john/Dev/Javascript/Angular/timetracker/node_modules/tapable/lib/Tapable.js:249:35)
at resolver.doResolve.createInnerCallback (/Users/john/Dev/Javascript/Angular/timetracker/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:44:6)
@ ./src/styles.css 4:14-138
@ multi ./src/styles.css
Similar problem here, when upgrading the @angular/cli from 1.6.3 to 16.4
ERROR in ./node_modules/css-loader?{"sourceMap":false,"import":false}!./node_modules/postcss-loader/lib?{"ident":"postcss","sourceMap":false}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/styles.scss Module build failed: Error: Can't resolve '~font-awesome/css/font-awesome.css' in '/Users/arturo/Desktop/lab-admin/src' at onError (/Users/arturo/Desktop/lab-admin/node_modules/enhanced-resolve/lib/Resolver.js:61:15) at loggingCallbackWrapper (/Users/arturo/Desktop/lab-admin/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19) at runAfter (/Users/arturo/Desktop/lab-admin/node_modules/enhanced-resolve/lib/Resolver.js:158:4) at innerCallback (/Users/arturo/Desktop/lab-admin/node_modules/enhanced-resolve/lib/Resolver.js:146:3) at loggingCallbackWrapper (/Users/arturo/Desktop/lab-admin/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19) at next (/Users/arturo/Desktop/lab-admin/node_modules/tapable/lib/Tapable.js:252:11) at /Users/arturo/Desktop/lab-admin/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:40:4 at loggingCallbackWrapper (/Users/arturo/Desktop/lab-admin/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19) at runAfter (/Users/arturo/Desktop/lab-admin/node_modules/enhanced-resolve/lib/Resolver.js:158:4) at innerCallback (/Users/arturo/Desktop/lab-admin/node_modules/enhanced-resolve/lib/Resolver.js:146:3) at loggingCallbackWrapper (/Users/arturo/Desktop/lab-admin/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19) at next (/Users/arturo/Desktop/lab-admin/node_modules/tapable/lib/Tapable.js:252:11) at innerCallback (/Users/arturo/Desktop/lab-admin/node_modules/enhanced-resolve/lib/Resolver.js:144:11) at loggingCallbackWrapper (/Users/arturo/Desktop/lab-admin/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19) at next (/Users/arturo/Desktop/lab-admin/node_modules/tapable/lib/Tapable.js:249:35) at resolver.doResolve.createInnerCallback (/Users/arturo/Desktop/lab-admin/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:44:6) @ ./src/styles.scss 4:14-191 @ multi ./src/styles.scss
I had to downgrade back to 1.6.3...
Meet the same issue.
Same issue here.
In my case there is build outside angular project directory
_ _ ____ _ ___ / \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _| / △ \ | '_ \ / _
| | | | |/ ` | '| | | | | | |
/ | | | | (| | || | | (_| | | | || | | |
// __| ||_, |_,||_,|| __|__||
|/
Angular CLI: 1.6.4 Node: 6.10.0 OS: win32 x64 Angular: 5.2.0 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router
@angular/cli: 1.6.4 @angular-devkit/build-optimizer: 0.0.37 @angular-devkit/core: 0.0.24 @angular-devkit/schematics: 0.0.45 @ngtools/json-schema: 1.1.0 @ngtools/webpack: 1.9.4 @schematics/angular: 0.1.12 typescript: 2.4.2 webpack: 3.10.0`
ERROR in ./src/styles.scss Module build failed: ModuleNotFoundError: Module not found: Error: Can't resolve './cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff' in 'c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\fronten d\src' at factoryCallback (c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\node_modules\webpack\lib\Compilation.js:276:40) at factory (c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\node_modules\webpack\lib\NormalModuleFactory.js:235:20) at resolver (c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\node_modules\webpack\lib\NormalModuleFactory.js:60:20) at asyncLib.parallel.e (c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\node_modules\webpack\lib\NormalModuleFactory.js:127:20) at c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\node_modules\async\dist\async.js:3874:9 at c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\node_modules\async\dist\async.js:473:16 at iteratorCallback (c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\node_modules\async\dist\async.js:1048:13) at c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\node_modules\async\dist\async.js:958:16 at c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\node_modules\async\dist\async.js:3871:13 at resolvers.normal.resolve (c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\node_modules\webpack\lib\NormalModuleFactory.js:119:22) at onError (c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\node_modules\enhanced-resolve\lib\Resolver.js:65:10) at loggingCallbackWrapper (c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\node_modules\enhanced-resolve\lib\createInnerCallback.js:31:19) at runAfter (c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\node_modules\enhanced-resolve\lib\Resolver.js:158:4) at innerCallback (c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\node_modules\enhanced-resolve\lib\Resolver.js:146:3) at loggingCallbackWrapper (c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\node_modules\enhanced-resolve\lib\createInnerCallback.js:31:19) at next (c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\node_modules\tapable\lib\Tapable.js:252:11) @ ./src/styles.scss @ multi ./node_modules/font-awesome/css/font-awesome.min.css ./node_modules/primeng/resources/primeng.min.css ./node_modules/bootstrap/dist/css/bootstrap.css ./src/styles.scss ERROR in ./src/styles.scss Module not found: Error: Can't resolve './cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff' in 'c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\src' resolve './cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff' in 'c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\src' using description file: c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\package.json (relative path: ./src) Field 'browser' doesn't contain a valid alias configuration after using description file: c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\package.json (relative path: ./src) using description file: c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\package.json (relative path: ./src/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff) no extension Field 'browser' doesn't contain a valid alias configuration c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\src\cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff doesn't exist .ts Field 'browser' doesn't contain a valid alias configuration c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\src\cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff.ts doesn't exist .js Field 'browser' doesn't contain a valid alias configuration c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\src\cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff.js doesn't exist as directory c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\src\cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff doesn't exist [c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\src\cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff] [c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\src\cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff.ts] [c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\src\cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff.js] [c:\Users\psokolik.TEMPEST\WORKSPACE\m2m-portal\portals\frontend\src\cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff] @ ./src/styles.scss 7:232-293 @ multi ./node_modules/font-awesome/css/font-awesome.min.css ./node_modules/primeng/resources/primeng.min.css ./node_modules/bootstrap/dist/css/bootstrap.css ./src/styles.scss
same issue just after the upgrade from @angular/cli 1.6.3 to 1.6.4
ERROR in ./node_modules/css-loader?{"sourceMap":false,"import":false}!./node_modules/postcss-loader/lib?{"ident":"postcss","sourceMap":false}!./src/styles.css Module build failed: Error: Can't resolve '~font-awesome/css/font-awesome.min.css' in 'D:\PRJ\GIT\PCE\pce-webui\src' at onError (D:\PRJ\GIT\PCE\pce-webui\node_modules\enhanced-resolve\lib\Resolver.js:61:15) at loggingCallbackWrapper (D:\PRJ\GIT\PCE\pce-webui\node_modules\enhanced-resolve\lib\createInnerCallback.js:31:19) at runAfter (D:\PRJ\GIT\PCE\pce-webui\node_modules\enhanced-resolve\lib\Resolver.js:158:4) at innerCallback (D:\PRJ\GIT\PCE\pce-webui\node_modules\enhanced-resolve\lib\Resolver.js:146:3) at loggingCallbackWrapper (D:\PRJ\GIT\PCE\pce-webui\node_modules\enhanced-resolve\lib\createInnerCallback.js:31:19) at next (D:\PRJ\GIT\PCE\pce-webui\node_modules\tapable\lib\Tapable.js:252:11) at D:\PRJ\GIT\PCE\pce-webui\node_modules\enhanced-resolve\lib\UnsafeCachePlugin.js:40:4 at loggingCallbackWrapper (D:\PRJ\GIT\PCE\pce-webui\node_modules\enhanced-resolve\lib\createInnerCallback.js:31:19) at runAfter (D:\PRJ\GIT\PCE\pce-webui\node_modules\enhanced-resolve\lib\Resolver.js:158:4) at innerCallback (D:\PRJ\GIT\PCE\pce-webui\node_modules\enhanced-resolve\lib\Resolver.js:146:3) at loggingCallbackWrapper (D:\PRJ\GIT\PCE\pce-webui\node_modules\enhanced-resolve\lib\createInnerCallback.js:31:19) at next (D:\PRJ\GIT\PCE\pce-webui\node_modules\tapable\lib\Tapable.js:252:11) at innerCallback (D:\PRJ\GIT\PCE\pce-webui\node_modules\enhanced-resolve\lib\Resolver.js:144:11) at loggingCallbackWrapper (D:\PRJ\GIT\PCE\pce-webui\node_modules\enhanced-resolve\lib\createInnerCallback.js:31:19) at next (D:\PRJ\GIT\PCE\pce-webui\node_modules\tapable\lib\Tapable.js:249:35) at resolver.doResolve.createInnerCallback (D:\PRJ\GIT\PCE\pce-webui\node_modules\enhanced-resolve\lib\DescriptionFilePlugin.js:44:6) @ ./src/styles.css 4:14-138 @ multi ./src/styles.css
jep, confirmed, same issue.
@baggior Remove '~' from import.
@Taha-Di-Nero This worked but now I am getting an error inside webstorm ('Cannot resolve directory...') maybe from angular service? Btw this '~' this worked in the past, so I believe it is a bug.
@skiabox see @clydin https://github.com/angular/angular-cli/issues/9181#issuecomment-357223293
@Taha-Di-Nero That will cause the defect in the original issue to again manifest.
The original issue was related to CSS url functions and windows path normalization (i.e., \
vs /
). This has been corrected in 1.6.4.
This is unconnected to the import issue observed by others in this issue. Of which there are two:
Stop
Jérémie Flahaut
Le 12 janv. 2018 à 15:17, clydin notifications@github.com a écrit :
@Taha-Di-Nero That will cause the defect in the original issue to again manifest.
The original issue was related to CSS url functions and windows path normalization (i.e., \ vs /). This has been corrected in 1.6.4.
This is unconnected to the import issue observed by others in this issue. Of which there are two:
For the issue reported by @cpboyd, this is a confirmed defect and will be corrected in the next patch release (the workaround identified will be necessary until then). Note that SCSS already behaved in this manner and unfortunately there is no easy fix to address this within SCSS at this time. For the tilde within imports issue, this is also a confirmed defect and will be corrected in the next patch release. Removing the tilde should allow the import to function. The tilde is actually a webpack specific addition; and when possible, and not inconvenient, removing its use will increase the transportability of the source. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
This sounds like something that could have easily been prevented by an automated tests, merely trying to build a trivial off-the-shelf Angular Material app (the kind of app you would build following Angular Material quickstart docs). I wonder if the CLI team could be persuaded to include something like that in the CLI test suite?
Still the same error with @angular/cli@1.6.6
Still get same error with 1.6.7 By the way I figured out that error happens only with .css files import. For example:
@import "~font-awesome/css/font-awesome.css"; // Compile error
but
@import "~font-awesome/less/font-awesome.less"; // No error
it looks a bit strange
Is this issue abandoned? @hansl, do you guys have any plans to fix it?
@Iverson All of the issues discussed in this thread have been addressed if using the latest stable release (1.7.3). If you are still encountering issues while using this version (within the project), please open a new issue with a minimal reproduction that demonstrates the problem.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
Hi! I noticed that I cannot build my app properly on Windows, the problem seems to lie in ~ import in sass file (bootstrap specifically), the resolved path looks broken because it is doubled, take a look at the log
I guess the problem was caused by this code https://github.com/angular/angular-cli/commit/9caa7ca#diff-aa06fda1fc53d1b1e6d1259f3cf4ca2d . The resolved path for fonts becomes
c:\vhosts\frontend-client\src\c:vhosts�rontend-clientnode_modules�ootstrap-sass ssets�onts�ootstrapglyphicons-halflings-regular.eot
Versions
Repro steps
$icon-font-path: '~bootstrap-sass/assets/fonts/bootstrap/';
at the top@import "~bootstrap-sass/assets/stylesheets/bootstrap";
Observed behavior
Desired behavior
Successful build