• npm install node-sass 报错如何解决呢


    npm install node-sass 报错如何解决呢
    node需要卸载重新安装,注意 官网下载msi执行后,能看到node-v 但需要配置全局path和创建cache和global。具体要搜一下。
    另外这可能是 python安装错误 或未安装,解决方式就是安装一下
    也可能是vsc++没有安装,安装一下
    也可能是node-sass没安装成功,建议直接卸载了,安装sass

    以下为我的部分参考:
    鉴于国内的环境,node-sass实在是太难安装了,可以直接通过淘宝的npm镜像来安装。

    在项目文件夹下安装node-sass

    npm install -g cnpm --registry=https://registry.npm.taobao.org
    cnpm install --save-dev node-sass
    
    • 1
    • 2

    说明:–save-dev自动将node-sass加入到项目文件夹下的package.json中。

    不同node-sass版本的环境
    https://github.com/sass/node-sass/releases

    安装中出现问题总结
    两步骤解决出现Node Sass version 7.0.0 is incompatible with 4.0.0错误使用 create-react-app 构建前端工程
    想要使用sass,安装好 npm install node-sass --save
    启动服务报错:
    Node Sass version 7.0.1 is incompatible with ^4.0.0
    看错误是不兼容导致的

    npm uninstall node-sass
    npm i -D sass
    
    • 1
    • 2
    npm notice
    npm notice New minor version of npm available! 8.12.1 -> 8.13.1
    npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.13.1
    npm notice Run npm install -g npm@8.13.1 to update!
    npm notice
    npm ERR! code 1
    npm ERR! path E:\V1.1-dev2\02.document\03 软件设计\林强代码和文档\gisBranches\gisPlotV2.0.0\node_modules\node-sass
    npm ERR! command failed
    npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js
    npm ERR! Building: C:\Program Files\nodejs\node.exe E:\V1.1-dev2\02.document\03 软件设计\林强代码和文档\gisBranches\gisPlotV2.0.0\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
    npm ERR! gyp info it worked if it ends with ok
    npm ERR! gyp verb cli [
    npm ERR! gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
    npm ERR! gyp verb cli   'E:\\V1.1-dev2\\02.document\\03 软件设计\\林强代码和文档\\gisBranches\\gisPlotV2.0.0\\node_modules\\node-gyp\\bin\\node-gyp.js',
    npm ERR! gyp verb cli   'rebuild',
    npm ERR! gyp verb cli   '--verbose',
    npm ERR! gyp verb cli   '--libsass_ext=',
    npm ERR! gyp verb cli   '--libsass_cflags=',
    npm ERR! gyp verb cli   '--libsass_ldflags=',
    npm ERR! gyp verb cli   '--libsass_library='
    npm ERR! gyp verb cli ]
    npm ERR! gyp info using node-gyp@7.1.2
    npm ERR! gyp info using node@18.4.0 | win32 | x64
    npm ERR! gyp verb command rebuild []
    npm ERR! gyp verb command clean []
    npm ERR! gyp verb clean removing "build" directory
    npm ERR! gyp verb command configure []
    npm ERR! gyp verb find Python Python is not set from command line or npm configuration
    npm ERR! gyp verb find Python Python is not set from environment variable PYTHON
    npm ERR! gyp verb find Python checking if "python3" can be used
    npm ERR! gyp verb find Python - executing "python3" to get executable path
    npm ERR! gyp verb find Python - "python3" is not in PATH or produced an error
    npm ERR! gyp verb find Python checking if "python" can be used
    npm ERR! gyp verb find Python - executing "python" to get executable path
    npm ERR! gyp verb find Python - executable path is "C:\Python39\python.exe"
    npm ERR! gyp verb find Python - executing "C:\Python39\python.exe" to get version
    npm ERR! gyp verb find Python - version is "3.9.7"
    npm ERR! gyp info find Python using Python version 3.9.7 found at "C:\Python39\python.exe"
    npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 18.4.0
    npm ERR! gyp verb command install [ '18.4.0' ]
    npm ERR! gyp verb install input version string "18.4.0"
    npm ERR! gyp verb install installing version: 18.4.0
    npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
    npm ERR! gyp verb install version is already installed, need to check "installVersion"
    npm ERR! gyp verb got "installVersion" 9
    npm ERR! gyp verb needs "installVersion" 9
    npm ERR! gyp verb install version is good
    npm ERR! gyp verb get node dir target node version installed: 18.4.0
    npm ERR! gyp verb build dir attempting to create "build" dir: E:\V1.1-dev2\02.document\03 软件设计\林强代码和文档\gisBranches\gisPlotV2.0.0\node_modules\node-sass\build
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
  • 相关阅读:
    ElasticSearch7.3学习(二十二)----Text字段排序、Scroll分批查询场景解析
    零基础想学习C++,应该怎么开始入手?
    Java 基础_框架阶段核心面试题
    lintcode 581 · 最长重复子序列【中等 vip 动态规划 /递归】
    手动导入jar包,pom还是爆红是什么情况
    金仓数据库 KingbaseES 客户端编程接口指南 - JDBC(11. JDBC 示例说明)
    codeforces:Codeforces Round #821 (Div. 2) 【思维 + 贪心分贡献的dp】
    Python学习第六篇:lambda 表达式
    pytest方法间变量值传递--request夹具
    “益路同行”栏目人物专访第0001期—笨爸爸工房创始人张旭健先生
  • 原文地址:https://blog.csdn.net/qlin_11/article/details/125441010