I'm in a react project that runs perfectly with no errors or warning when using yarn start
, but when I try yarn build
I get the following error in my console:
Cannot read property 'toLowerCase' of undefined
CompileError: Begins at CSS selector .m-n1
I have already searched in my code and there's no ".m-n1" class or something like this in any component or scss.
Here it is my package.json file
"name": "removedForThisPost",
"version": "0.1.0",
"private": true,
"dependencies": {
"@clayui/alert": "^3.40.0",
"@clayui/card": "^3.41.0",
"@clayui/core": "^3.41.0",
"@clayui/css": "^3.41.0",
"@clayui/drop-down": "^3.41.0",
"@clayui/empty-state": "^3.40.0",
"@clayui/form": "^3.40.0",
"@clayui/icon": "^3.40.0",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@types/jest": "^26.0.15",
"@types/node": "^12.0.0",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"axios": "^0.24.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"sass": "^1.45.0",
"timeago.js": "^4.0.2",
"typescript": "^4.1.6",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Extra information: I'm using NVM for node versions and at this moment I'm at Node 14.18.2 (npm v6.14.15)!
If you guys need any other information let me know!
CodePudding user response:
okay, I found for the exact same issue that u were dealingwith, here is a solution for you npm run build - Failed to compile - Cannot read property 'toLowerCase' of undefined To summarize this, you got a problem with a missing value in your code. also, try to search in your code with ctrl shift f command ".m-n1"
CodePudding user response:
Just in case:
Have you search in your project the term "m-n1" as well? (I mean just "m-n1", without beginning it in period/dot).
If you didn't, try again and you will probably find a css file which will have some kind of error in the code (a missing attribute separator sign, a typo, ...).