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

相关推荐
幸运小圣2 小时前
Vue3 -- 项目配置之stylelint【企业级项目配置保姆级教程3】
开发语言·后端·rust
fukaiit3 小时前
vue项目npm run serve出现【- Network: unavailable】(从排查到放弃)
npm·vue·node·win11
promise-render3 小时前
npm、yarn、pnpm 切换查看镜像源笔记
前端·笔记·npm
修复bug3 小时前
npm完整发包流程(亲测可验证)
前端·npm·开源
丁总学Java3 小时前
使用 npm 安装 Yarn
前端·npm·node.js
老猿讲编程3 小时前
Rust编写的贪吃蛇小游戏源代码解读
开发语言·后端·rust
丁总学Java6 小时前
npm list @types/node 命令用于列出当前项目中 @types/node 包及其依赖关系
前端·npm·node.js
yezipi耶不耶9 小时前
Rust 所有权机制
开发语言·后端·rust
喜欢打篮球的普通人9 小时前
rust并发
rust
大鲤余13 小时前
Rust开发一个命令行工具(一,简单版持续更新)
开发语言·后端·rust