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

相关推荐
l1t10 小时前
测试DuckDB电子表格读取插件rusty_sheet 0.2版
数据库·rust·插件·xlsx·duckdb
scorpion_V16 小时前
VScode 中执行 npm 报错的问题
ide·vscode·npm
嚴寒20 小时前
被10个终端窗口逼疯后,我用Rust写了个零依赖跨平台终端Agent启动神器
rust·agent
FreeBuf_21 小时前
攻击者利用Discord Webhook通过npm、PyPI和Ruby软件包构建隐蔽C2通道
前端·npm·ruby
alwaysrun2 天前
Rust中模式匹配
rust·match·模式匹配·if let·while let·值绑定
程序铺子2 天前
如何使用 npm 安装 sqlite3 和 canvas 这些包
javascript·npm·node.js
编码浪子2 天前
Dioxus hot-dog 总结
rust
gc_22993 天前
Ape.Volo项目启动前端项目时报错“digital envelope routines::unsupported”
npm
光影少年3 天前
rust生态及学习路线,应用领域
开发语言·学习·rust
Kiri霧3 天前
Linux下的Rust 与 C 的互操作性解析
c语言·开发语言·rust