vue项目启动的报错问题

news/2024/10/12 14:53:26/

背景

三年前的一个vue3项目,当时用的14版本开发的,最近想把它接入到我的主应用中,在启动中,由于自己用的node版本是16+,导致安装依赖的时候,发生了报错

具体报错内容

npm WARN deprecated node-sass@4.14.1: Node Sass is no longer supported. Please use `sass` or `sass-embedded` instead.
npm WARN deprecated eslint@6.8.0: This version is no longer supported. Please see https://eslint.org/version-support for other options.
npm ERR! code 1
npm ERR! path /Users/gaoyongpeng/test-error/constellation-pro/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c -- node scripts/build.js
npm ERR! Building: /Users/gaoyongpeng/.nvm/versions/node/v16.20.2/bin/node /Users/gaoyongpeng/test-error/constellation-pro/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   '/Users/gaoyongpeng/.nvm/versions/node/v16.20.2/bin/node',
npm ERR! gyp verb cli   '/Users/gaoyongpeng/test-error/constellation-pro/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@3.8.0
npm ERR! gyp info using node@16.20.2 | darwin | arm64
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 WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
npm ERR! gyp verb download using dist-url https://npmmirror.com/mirrors/node
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (/Users/gaoyongpeng/test-error/constellation-pro/node_modules/which/which.js:13:12)
npm ERR! gyp verb `which` failed     at F (/Users/gaoyongpeng/test-error/constellation-pro/node_modules/which/which.js:68:19)
npm ERR! gyp verb `which` failed     at E (/Users/gaoyongpeng/test-error/constellation-pro/node_modules/which/which.js:80:29)
npm ERR! gyp verb `which` failed     at /Users/gaoyongpeng/test-error/constellation-pro/node_modules/which/which.js:89:16
npm ERR! gyp verb `which` failed     at /Users/gaoyongpeng/test-error/constellation-pro/node_modules/isexe/index.js:42:5
npm ERR! gyp verb `which` failed     at /Users/gaoyongpeng/test-error/constellation-pro/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:202:21)
npm ERR! gyp verb `which` failed  python2 Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (/Users/gaoyongpeng/test-error/constellation-pro/node_modules/which/which.js:13:12)
npm ERR! gyp verb `which` failed     at F (/Users/gaoyongpeng/test-error/constellation-pro/node_modules/which/which.js:68:19)
npm ERR! gyp verb `which` failed     at E (/Users/gaoyongpeng/test-error/constellation-pro/node_modules/which/which.js:80:29)
npm ERR! gyp verb `which` failed     at /Users/gaoyongpeng/test-error/constellation-pro/node_modules/which/which.js:89:16
npm ERR! gyp verb `which` failed     at /Users/gaoyongpeng/test-error/constellation-pro/node_modules/isexe/index.js:42:5
npm ERR! gyp verb `which` failed     at /Users/gaoyongpeng/test-error/constellation-pro/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:202:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH

分析

大家看到这里,很多同行可能就会头痛,不过npm i 发生类似这样的报错,我们可以看在报错之前的正常日志
node-sass@4.14.1: Node Sass is no longer supported. Please use sass or sass-embedded instead.

  • 这里明显的给出,package.json中的node-sass依赖在当前node环境下,不再支持使用,让我们替换为sass or sass-embedded

解决方案

根据提示,替换适合自己的依赖即可,这里我们针对sass就使用sass 就可以了。

写在最后

如果有帮到大家,记得给博主点个赞!


http://www.ppmy.cn/news/1537911.html

相关文章

知识图谱入门——11:构建动态图谱渲染应用:Vue3与Neo4j的集成与实践

在知识图谱与大数据技术领域,构建动态图谱是一项非常重要的任务。这篇博客将带你深入了解如何利用Vue.js、D3.js以及Neo4j,开发一个能够实时渲染图谱节点和关系的应用。我们将从零开始,介绍如何搭建开发环境、安装依赖、与Neo4j数据库交互、到…

CocosCreator 快速部署 TON 游戏:Web2 游戏如何使用 Ton支付

在本篇文章中,我们将继续探讨如何使用 Cocos Creator 开发 Telegram 游戏,重点介绍如何集成 TON 支付功能。通过这一教程,开发者将学会如何在游戏中接入 TON Connect,实现钱包连接、支付以及支付后的校验流程,最终为 W…

《Windows PE》4.3 延迟加载导入表

延迟加载导入表(Delayed Import Table)是PE文件中的一个数据结构,用于实现延迟加载(Lazy Loading)外部函数的机制。 延迟加载是指在程序运行时,只有当需要使用某个外部函数时才进行加载和绑定,…

第二份代码:PointNet++

参考的依然是Pytorch的实现,PointNet里面的主要实现部分都在utils.py里,里面从微小模块逐渐的,搭建出网络中的几个主要模块结构,包括sampling&group等,所以我们主要分析的就是这个utils.py里面的内容 这份Pytorch实…

JS 运算符

目录 1. 赋值运算符 2. 一元运算符 2.1 自增 2.1.1 前置自增 2.1.2 后置自增 2.1.3 前置与后置自增对比 3. 比较运算符 3.1 字符串比较 4. 逻辑运算符 4.1 案例 5. 运算符优先级 1. 赋值运算符 2. 一元运算符 2.1 自增 2.1.1 前置自增 2.1.2 后置自增 2.1.3 前置与后…

DB-GPT 安装

从源代码开始安装,因为docker镜像库不能用了。。。 参考官网: https://docs.dbgpt.site/docs/latest/quickstart 安装文档 - source https://docs.dbgpt.site/docs/latest/installation/sourcecode 下载源代码 Download DB-GPT git clone https://gith…

边缘人工智能(Edge Intelligence)

边缘人工智能(Edge AI)是指在边缘设备上直接运行人工智能(AI)和机器学习(ML)算法的技术。机器学习是一个广泛的领域,近年来取得了巨大的进步。它所基于的原则是,计算机可以通过从数据…

[C语言]结构体

1.什么是结构体 结构是多种类型的数据的集合。。且每个结构成员都有名字,因此当使用特定的成员时需要指明结构体成员的名字。 2.结构体的声明 以学生的数据为例: struct student //student结构名{char name; //name结构体成员名int height;…