【问题标题】:Issue with node-sass in angular 4 projectAngular 4 项目中的 node-sass 问题
【发布时间】:2018-09-20 22:14:52
【问题描述】:

在运行现有 Angular4 应用程序时,我在 MAC 上遇到以下问题。它在执行ng serve时向我显示了这个错误

错误 ./node_modules/css-loader?{"sourceMap":false,"import":false}!./node_modules/postcss-loader/lib?{"ident":"postcss","sourceMap":false}!./ node_modules/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./node_modules/angular-calendar-week-hours-view/angular-calendar -week-hours-view.scss 模块构建失败:错误:找不到模块“node-sass”

我在 angular-cli.json 中导入样式如下

"styles": [
        "../node_modules/angular-calendar-week-hours-view/angular-calendar-week-hours-view.scss"
      ],

可能的问题是什么?

"styleExt": "scss",

在 angular-cli.json 中将 styleExt 添加为 scss。 我确实有节点 9.11.1

【问题讨论】:

  • 您事先运行过npm install 吗?您正在运行ng servenpm run start,后者会启动ng serve
  • 我运行了 npm install,但没有成功。然后我又做了三种方式,sudo npm i node-sass, sudo npm install node-sass
  • 尝试重建 node-saas。 npm 重建节点-sass
  • npm 重建 node-sass 完成。同样的错误

标签: angular node-modules angular-calendar


【解决方案1】:

最新的 node.js 版本存在问题。安装旧版本 6.8.0 后问题已解决

最新版本向npm install node-sass 抛出错误 它在低版本中运行良好。

【讨论】:

  • 必须有另一种方法来实现它,而不是回到 2.* 版本
猜你喜欢
  • 1970-01-01
  • 2019-10-02
  • 2019-04-18
  • 2022-08-11
  • 2019-10-06
  • 1970-01-01
  • 2019-12-06
  • 1970-01-01
  • 2023-04-04
相关资源
最近更新 更多