npm/node-sass安装依赖报错

Failed to resolve loader: sass-loader

bash 复制代码
 ERROR  Failed to compile with 1 error                                                                                                                                           10:49:21

Failed to resolve loader: sass-loader
You may need to install it.

npm ERR! code E404

bash 复制代码
$ npm install nodes-sass --save-dev --legacy-peer-deps
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/nodes-sass - Not found
npm ERR! 404
npm ERR! 404  'nodes-sass@*' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! A complete log of this run can be found in:

修改镜像地址: --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/

bash 复制代码
$ npm i node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/ --legacy-peer-deps
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN deprecated eslint-loader@2.2.1: This loader has been deprecated. Please use eslint-webpack-plugin
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.

added 338 packages, and changed 95 packages in 2m

118 packages are looking for funding
  run `npm fund` for details
bash 复制代码
$ npm i sass-loader --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/ --legacy-peer-deps
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

added 1 package in 2m

118 packages are looking for funding
  run `npm fund` for details

最终安装完成

bash 复制代码
$ node -v
v16.16.0

package.json

bash 复制代码
"dependencies": {
	#...略其它...
    "node-sass": "^9.0.0",
    "sass-loader": "^13.3.2",
 }

参照更多: https://juejin.cn/post/7029193821955031054

相关推荐
lpfasd1236 小时前
node-sass 停止维护!老项目迁移 Dart Sass 完整教程
前端·rust·sass
Flynt7 小时前
我把真实的 ES 查询怼到 7059 星的 Rust 搜索引擎上:1366/1369 的兼容承诺,裂了 3 个缝
elasticsearch·搜索引擎·rust
小杍随笔10 小时前
egui 0.37 升级实录:卡顿修复与5倍性能回退
windows·rust·egui
小天源14 小时前
智叟云集定时采集与消息推送架构——实现可恢复的订阅通知流程
架构·sass·权限管理·多租户·服务商 api·ai采集
geovindu17 小时前
rust: Iterator Pattern
开发语言·后端·设计模式·rust·行为模式·迭代器模
kiracrimson18 小时前
npm 入门:包管理器、依赖与 npx
前端·npm·node.js
gopher951121 小时前
RUST:错误处理 thiserror 详解
开发语言·后端·rust
geovindu1 天前
rust:Memento Pattern(续)
开发语言·后端·设计模式·rust·行为模式·备忘录模
Kapaseker2 天前
同样 4 行代码,C++ 编译通过,Rust 为什么直接拒绝?
rust
迪幻2 天前
封装自己的 npm 依赖并存储到个人 GitHub
前端·npm·github