【问题标题】:Why has my server stopped working after trying to install SCSS?为什么我的服务器在尝试安装 SCSS 后停止工作?
【发布时间】:2021-11-23 18:48:21
【问题描述】:

目前,我正在学习 React 开发课程。作为课程的一部分,我们必须安装 SCSS 来设置电子商务应用程序的样式。到目前为止,我已经尝试避免使用 SCSS 并将代码重新格式化为 CSS。但是,由于 CSS 中没有 $SCSS 等价物,我不得不安装 SCSS。不过,写完之后

npm add node-sass

我不得不重新启动我的服务器,我得到了最后说明的错误。在课程中,他们提到可能存在一些错误,在这种情况下,我们应该使用以下几行

rm -rf npm.lock
rm -rf node_modules

尽管使用了这些行,我的服务器仍然无法启动,而且我仍然无法继续,因为我需要 SCSS 才能工作,为此,我需要我的服务器工作,因为我需要重新启动它才能安装 NCSS。在以下几行中,我将留下尝试启动服务器时收到的错误消息。 npm 和 node 已经安装好了。

aaronserpilin@Aarons-MacBook-Air crown-clothing % npm start

> crown-clothing@0.1.0 start /Users/aaronserpilin/crown-clothing
> react-scripts start

sh: react-scripts: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! crown-clothing@0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the crown-clothing@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/aaronserpilin/.npm/_logs/2021-10-02T13_22_23_006Z-debug.log
aaronserpilin@Aarons-MacBook-Air crown-clothing % 

【问题讨论】:

  • 删除 node_modules 后是否运行“npm install”?
  • 可以,但是还是不行
  • "react-scripts: command not found" 表示没有安装 react-scripts。 npm install 后出现什么错误?
  • 我没有收到任何错误。每次我写 npm install 它都会重新开始安装

标签: node.js reactjs npm sass


【解决方案1】:

您使用的 node-sass 版本是什么?

我使用了 node-sass@4.14.1 并且 react@17.0.0 是工作

【讨论】:

    猜你喜欢
    • 2011-09-07
    • 2019-10-04
    • 1970-01-01
    • 2019-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-05
    • 2020-12-17
    相关资源
    最近更新 更多