tailwind icon indicating copy to clipboard operation
tailwind copied to clipboard

cant ng build because => "Error: Unexpected '/'. Escaping special characters with \ may help."

Open ohabash opened this issue 3 years ago • 11 comments

I am trying to ng serve --prod but i get an error.

Error: Unexpected '/'. Escaping special characters with \ may help.

Looking online. It seems to be an issue with escaping \ when using @apply (example => @apply text-8\/2 font-bold;)

However — i don't have any @applys that use \. Also when i use @apply vscode gives me syntax errors despite using postcss language support

semi-colon expectedscss(css-semicolonexpected)

Screen Shot 2021-05-27 at 12 25 32 PM

"@ngneat/tailwind": "^7.0.3", "@angular/cli": "12.0.0", "@nrwl/cli": "12.3.4", "@nrwl/cypress": "12.3.4", "@nrwl/eslint-plugin-nx": "12.3.4", "@nrwl/jest": "12.3.4", "@nrwl/linter": "12.3.4", "@nrwl/nx-cloud": "latest", "@nrwl/storybook": "^12.3.4", "@nrwl/tao": "12.3.4", "@nrwl/workspace": "12.3.4",

ohabash avatar May 27 '21 17:05 ohabash

@ohabash Any updates on it? I'm getting the same error and I have no clue at all of what is going on. I'm getting it when I try to build using --prod flag, and it started happening after I upgraded to Angular 12.

Capture *ps: The file D:\Code\Airbox\frontend\styles.db88f49885480a545f73.css:9031:1 does not exist, it somehow is created and read by the build --prod command.

ng build (without --prod) and ng serve are working properly.

cassiogroh avatar Jun 19 '21 19:06 cassiogroh

I could find a work around and posted it here on stack overflow. I hope it helps someone.

cassiogroh avatar Jun 23 '21 02:06 cassiogroh

I am facing the same problem, any solution found?

rohittidke avatar Jul 28 '21 11:07 rohittidke

Did someone found the root cause? let me know if you found any clue?

Jackeysharath avatar Jul 30 '21 02:07 Jackeysharath

@Jackeysharath my problem was resolved, it was not related to tailwin, it was due to */ comment which was not completed. the angular compiler doesn't look for errors in the CSS declarations so it doesn't show compile errors.

rohittidke avatar Jul 30 '21 08:07 rohittidke

@rohittidke Thank you, I went to look through my files and realized that my css file has an uncompleted */ comment, hence this error message surfaced.

cornsarebanned avatar Aug 26 '21 19:08 cornsarebanned

It was really hard for me to find the solution, in my case it was because I had a comment into the scss file like this using "//comment" instead of "/comment/"

danielarevalo100 avatar Nov 24 '21 17:11 danielarevalo100

same issue with my code. Fixed by converting //comments to /* comments */

waqas-raza-dh avatar Jan 04 '22 22:01 waqas-raza-dh

ran into same issue, and @danielarevalo100 suggestion fixed it - had to convert // comment to /* comment*/

albertpak avatar Jan 13 '22 16:01 albertpak

@Jackeysharath This really helped.... for a comment typo i wasted like hours

iamabhshk avatar Feb 16 '22 21:02 iamabhshk

Same issue today with react, after debugging more than an hour I deleted the module file and reinstalled the packages again, which solved the problem for me.

Alhariri97 avatar Jun 27 '22 02:06 Alhariri97