TypeError:无法读取未定义的makeStyles.js的属性"attach" [英] TypeError: Cannot read property 'attach' of undefined makeStyles.js
问题描述
当尝试在生产版本上访问我的MERN应用程序的Login组件时,此图像显示了一系列以下类型错误:
When trying to access the Login component of my MERN app on the production version, I get a series of the following type errors shown in this image:
我的应用程序( https://github.com/ahaq0/kumon_schedule )在本地运行良好并在今天早些时候在Heroku上的托管工作正常.
My app (https://github.com/ahaq0/kumon_schedule) works perfectly fine locally and was working perfectly fine hosted on Heroku earlier today.
我试图回滚我今天所做的代码中的所有更改,但无济于事.同样,我检查了package.json(和.lock)以查看是否更改了实质性的UI依赖关系,但这是相同的.我似乎无法弄清楚为什么在托管版本此处突然停止工作的原因.
I tried rolling back all of the changes in the code that I made today to no avail. Similarly, I checked the package.json (and .lock) to see if I changed the material UI dependency but that was the same. I can't seem to figure out why it stopped working all of a sudden on the hosted version here.
错误所在行的代码如下.但是,由于它是材料用户界面的一部分,所以我没有写.
The code for the line of the error is below. However, I did not write as it's a part of material UI.
if (sheetManager.dynamicStyles) {
var dynamicSheet = stylesOptions.jss.createStyleSheet(sheetManager.dynamicStyles, _extends({
link: true
}, options));
dynamicSheet.update(props).attach();
state.dynamicSheet = dynamicSheet;
state.classes = mergeClasses({
baseClasses: sheetManager.staticSheet.classes,
newClasses: dynamicSheet.classes
});
if (sheetsRegistry) {
sheetsRegistry.add(dynamicSheet);
}
} else {
state.classes = sheetManager.staticSheet.classes;
}
sheetManager.refs += 1;
这是我第一个部署的应用程序,尽管我尽了最大的努力来回滚,但我却茫然不知所措,从工作状态变为不工作状态.
This is my first deployed app and I'm at a loss how everything went from working to not working despite my best attempts to roll things back.
编辑.我应该提到我在错误日志来自的Firefox和Chrome中进行了测试.
Edit. I should mention I tested in Firefox as well as Chrome where the error log is from.
编辑#2.经过大量调试后,我发现如果我回滚以通过Heroku提交fccc55a5,则该错误已消失.但是,如果我使用该提交创建了一个新分支,并尝试部署该分支,它将无法正常工作.
Edit #2. After a lot more debugging I found out that the error is gone if I roll back to commit fccc55a5 via Heroku. However, if I make a new branch with that commit and try to deploy that branch, it will not work.
请在此处查看 https://github.com/ahaq0/kumon_schedule/compare/fccc55a5 ... fccc55a5
当我恢复到Heroku中的最后一个版本时,它将起作用.但是,如果我将先前的提交合并到新分支中并尝试部署它,则不会.
When I revert to that last build in Heroku it will work. But if I merge that previous commit into a new branch and try to deploy it, it will not.
推荐答案
正在添加 "jss":"10.0.0" 到 依赖项":{} 为我解决了问题
Adding "jss": "10.0.0" to "dependencies": { } fixed the issue for me
---更新30.12.19 ---
"jss"现在可以删除,
"jss" can now be removed,
错误已修复:
"@material-ui/core": "4.8.2",
这篇关于TypeError:无法读取未定义的makeStyles.js的属性"attach"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!