【问题标题】:I got this errors while trying to create css modules using npm run eject尝试使用 npm runeject 创建 css 模块时出现此错误
【发布时间】:2019-06-11 14:54:57
【问题描述】:

我正在尝试实现 css 模块 运行 'npm runeject' 但我遇到了错误

我在 git 提交后运行了 "npm runeject"。现在我遇到了一些错误,看起来好像遗漏了一些东西,但我还想不通。

这是我在运行 npm runeject 后得到的错误日志

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!

【问题讨论】:

    标签: reactjs npm visual-studio-2015


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:

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

      git add . 
      git commit -m 'some message'
      

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

      【讨论】:

        猜你喜欢
        • 2020-05-21
        • 2020-04-23
        • 1970-01-01
        • 2013-02-23
        • 2020-10-09
        • 2021-11-18
        • 2021-03-05
        • 2014-12-14
        相关资源
        最近更新 更多