想用 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 [email protected]: 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 [email protected]: this library is no longer supported
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm warn deprecated [email protected]: 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 [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: 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 [email protected]
npm error gyp info using [email protected] | 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 环境,也不想搞,所以放弃了,总结来说,就是很老旧的东西,不想用

相关推荐
wmze27 分钟前
InnoDB存储引擎
后端
lifallen1 小时前
Java BitSet类解析:高效位向量实现
java·开发语言·后端·算法
子恒20052 小时前
警惕GO的重复初始化
开发语言·后端·云原生·golang
daiyunchao2 小时前
如何理解"LLM并不理解用户的需求,只是下一个Token的预测,但他能很好的完成任务,比如写对你想要的代码"
后端·ai编程
Android洋芋2 小时前
SettingsActivity.kt深度解析
后端
onejason3 小时前
如何利用 PHP 爬虫按关键字搜索 Amazon 商品
前端·后端·php
令狐冲不冲3 小时前
常用设计模式介绍
后端
Java水解3 小时前
深度解析MySQL中的Join算法:原理、实现与优化
后端·mysql
一语长情3 小时前
关于Netty的DefaultEventExecutorGroup使用
java·后端·架构
易元3 小时前
设计模式-状态模式
后端·设计模式