我在尝试使用 npm 运行 eject 创建 css 模块时遇到了这个错误

I got this errors while trying to create css modules using npm run eject

我正在尝试实现 css 模块 运行ning 'npm run eject' 但我出现错误

I 运行 "npm run eject" 在 git 提交之后。现在我遇到了一些错误,看起来好像遗漏了一些东西,但我还无法弄清楚。

这是我在 运行ning npm 运行 eject

之后得到的错误日志
Remove untracked files, stash or commit any changes, 
and try again.

npm ERR! code ELIFECYCLE 
npm ERR! errno 1
npm ERR! my-app@e.l.e eject:
npm ERR! Exit status 1 
npm ERR! 
npm ERR!  Failed at the my-app@e.l.ø eject script.
npm ERR! This is probably not a problem with npm. 
There is likely addi
npm ERR! A complete log of this run can be found 
in: 
npm ERR!

您似乎有一些未被 Git 追踪。从错误日志中,您可以找到解决问题的几种方法: 1) 使用终端将文件添加到新提交:

git add . 
git commit -m 'some message'

2) 如果您不需要未跟踪的文件,您必须找到并删除它们

CSS React 已经支持模块 (reference)。
您不再需要 运行 npm run eject(除非您的目标仍然是自己自定义一些东西)。

只需像这样命名您的 css 文件:[名称].module.css