想用 nodejs 启动一个 web 服务,但是遇到了 python2 的问题

init 项目没有问题

bash 复制代码
(v.v) ➜  hello npm init -y
Wrote to /Users/hmg/nodejs/tmp/hello/package.json:

{
  "name": "hello",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "type": "commonjs"
}

init 项目没有问题

但是 npm install press 遇到了 python2 的问题

bash 复制代码
(v.v) ➜  hello npm install press
npm warn deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm warn deprecated har-validator@5.1.5: this library is no longer supported
npm warn deprecated are-we-there-yet@1.1.7: This package is no longer supported.
npm warn deprecated rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported
npm warn deprecated osenv@0.1.5: This package is no longer supported.
npm warn deprecated gauge@2.7.4: This package is no longer supported.
npm warn deprecated fstream@1.0.12: This package is no longer supported.
npm warn deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated npmlog@4.1.2: This package is no longer supported.
npm warn deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.1.7: Glob versions prior to v9 are no longer supported
npm warn deprecated node-sass@4.5.3: Node Sass is no longer supported. Please use `sass` or `sass-embedded` instead.
npm error code 1
npm error path /Users/hmg/nodejs/tmp/hello/node_modules/node-sass
npm error command failed
npm error command sh -c node scripts/build.js
npm error Building: /Users/hmg/.nvm/versions/node/v24.2.0/bin/node /Users/hmg/nodejs/tmp/hello/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm error gyp info it worked if it ends with ok
npm error gyp verb cli [
npm error gyp verb cli   '/Users/hmg/.nvm/versions/node/v24.2.0/bin/node',
npm error gyp verb cli   '/Users/hmg/nodejs/tmp/hello/node_modules/node-gyp/bin/node-gyp.js',
npm error gyp verb cli   'rebuild',
npm error gyp verb cli   '--verbose',
npm error gyp verb cli   '--libsass_ext=',
npm error gyp verb cli   '--libsass_cflags=',
npm error gyp verb cli   '--libsass_ldflags=',
npm error gyp verb cli   '--libsass_library='
npm error gyp verb cli ]
npm error gyp info using node-gyp@3.8.0
npm error gyp info using node@24.2.0 | darwin | arm64
npm error gyp verb command rebuild []
npm error gyp verb command clean []
npm error gyp verb clean removing "build" directory
npm error gyp verb command configure []
npm error gyp verb check python checking for Python executable "python2" in the PATH
npm error gyp verb `which` failed Error: not found: python2
npm error gyp verb `which` failed     at getNotFoundError (/Users/hmg/nodejs/tmp/hello/node_modules/which/which.js:13:12)
npm error gyp verb `which` failed     at F (/Users/hmg/nodejs/tmp/hello/node_modules/which/which.js:68:19)
npm error gyp verb `which` failed     at E (/Users/hmg/nodejs/tmp/hello/node_modules/which/which.js:80:29)
npm error gyp verb `which` failed     at /Users/hmg/nodejs/tmp/hello/node_modules/which/which.js:89:16
npm error gyp verb `which` failed     at /Users/hmg/nodejs/tmp/hello/node_modules/isexe/index.js:42:5
npm error gyp verb `which` failed     at /Users/hmg/nodejs/tmp/hello/node_modules/isexe/mode.js:8:5
npm error gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:188:21)
npm error gyp verb `which` failed  python2 Error: not found: python2
npm error gyp verb `which` failed     at getNotFoundError (/Users/hmg/nodejs/tmp/hello/node_modules/which/which.js:13:12)
npm error gyp verb `which` failed     at F (/Users/hmg/nodejs/tmp/hello/node_modules/which/which.js:68:19)
npm error gyp verb `which` failed     at E (/Users/hmg/nodejs/tmp/hello/node_modules/which/which.js:80:29)
npm error gyp verb `which` failed     at /Users/hmg/nodejs/tmp/hello/node_modules/which/which.js:89:16
npm error gyp verb `which` failed     at /Users/hmg/nodejs/tmp/hello/node_modules/isexe/index.js:42:5
npm error gyp verb `which` failed     at /Users/hmg/nodejs/tmp/hello/node_modules/isexe/mode.js:8:5
npm error gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:188:21) {
npm error gyp verb `which` failed   code: 'ENOENT'
npm error gyp verb `which` failed }

我没有 python2 环境,也不想搞,所以放弃了,总结来说,就是很老旧的东西,不想用

相关推荐
南雨北斗8 分钟前
linux上TP6安装PHPMailer
后端
大菠萝学姐34 分钟前
基于Spring Boot和Vue的高校图书馆座位预约系统的设计与实现
java·vue.js·spring boot·后端·python·mysql·vue
南雨北斗1 小时前
PHP fileinfo扩展的作用
后端
Re2751 小时前
快速理解Spring Bean 实例化与初始化全过程
后端·spring
paopaokaka_luck3 小时前
基于Spring Boot+Vue的DIY手工社预约管理系统(Echarts图形化、腾讯地图API)
java·spring boot·后端
kk_stoper3 小时前
使用Ruby接入实时行情API教程
java·开发语言·javascript·数据结构·后端·python·ruby
我会冲击波3 小时前
告别flag与status:如何为你的布尔值(boolean)变量优雅命名?
java·后端
工藤学编程3 小时前
分库分表之实战-sharding-JDBC水平分库+分表后:查询与删除操作实战
数据库·spring boot·后端·sql·mysql
码出极致3 小时前
Redisson 分布式锁自动续期机制解析
后端
小塵3 小时前
【DeepSeek 聊天】五分钟部署本地 DeepSeek
人工智能·后端·deepseek