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

相关推荐
冬奇Lab20 小时前
一天一个开源项目(第42篇):OpenFang - 用 Rust 构建的 Agent 操作系统,16 层安全与 7 个自主 Hands
人工智能·rust·开源
量子位1 天前
Transformer论文作者重造龙虾,Rust搓出钢铁版,告别OpenClaw裸奔漏洞
rust·openai·ai编程
哈里谢顿1 天前
Rust 语言入门博客
rust
DongLi013 天前
rustlings 学习笔记 -- exercises/06_move_semantics
rust
ssshooter3 天前
Tauri 踩坑 appLink 修改后闪退
前端·ios·rust
布列瑟农的星空3 天前
前端都能看懂的rust入门教程(二)——函数和闭包
前端·后端·rust
无责任此方_修行中3 天前
如何利用 pnpm 的安全控制功能防御 npm 供应链攻击
javascript·npm·node.js
蚂蚁背大象4 天前
Rust 所有权系统是为了解决什么问题
后端·rust
布列瑟农的星空4 天前
前端都能看懂的rust入门教程(五)—— 所有权
rust
臣妾没空5 天前
里程碑5:完成框架npm包抽象封装并发布
前端·npm