这是我这个问题的最新示例。如果我能得到一个关于为什么会发生这种情况的详细答案并快速解决类似的问题,那将是最佳选择,但我会高兴地解决这个特定问题。
我正在尝试使用 node-gyp '^5.0.3' 构建我的 Node 'v10.17.0' 项目,但它无法编译 node-rdkafka '^2.9.1'。此版本的 node-gyp 需要 python '2.7'。我正在使用“2.7.16”。我的 npm 版本是“6.11.3”,我最近将 macOS 版本升级到了“11.4”。这些版本很重要,因为我现在无法更改它们。这项工作很快就会到来。我希望。
起初,我不断收到“为 macOS 11 构建,链接到 10.4”的错误。经过多次删除试验(命令行工具、Xcode 缓存、节点缓存等),我相信我摆脱了这个问题。现在我没有看到那个错误。但是,我仍然看到所有相同的错误和警告,并且生成的构建似乎仍然被破坏。在这篇文章的底部,我将添加我收到的相当大的错误消息。以下是我一直在尝试解决问题的一些命令。
# Fixing bad nodejs add-ons: #
## env vars for c++ (in ‘.bash_profile’) ##
export CPPFLAGS="-stdlib=libc++ -mmacosx-version-min=11.0"
export CFLAGS="-stdlib=libc++ -mmacosx-version-min=11.0"
export LDFLAGS="-mmacosx-version-min=11.0"
## reinstall command line tools ##
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
## clear c++ cache ##
rm -rf ~/Library/Caches/com.apple.dt.Xcode
rm -rf ~/Library/Preferences/com.apple.dt.Xcode.plist
## set python version ##
pyenv local system
pyenv global system
npm config set python system
## run yarn ##
rm -rf node_modules/
yarn cache clean
yarn --ignore-engines --pure-lockfile
## clear node cache and run npm with empty cache ##
rm -rf common/node_modules/
rm -rf /tmp/empty-cache
npm i --no-audit --cache /tmp/empty-cache
我已经尝试解决这个问题很长时间了,所以我能得到的任何帮助都将不胜感激。另外,我在网上看到过类似的问题。我不知道 macOS 和 node-gyp 之间的关系有什么重要的吗?我是否让自己陷入了一些需要升级的“版本锁定”?
还有一件事:最重要的是我需要在本地机器上启动并运行我的项目。有没有办法克服这个依赖问题,以便构建可以完成并且我可以回到稳定的开发环境?
我之前提到的一个错误片段:
In file included from project-root/node_modules/node-rdkafka/src/binding.h:21:
project-root/node_modules/node-rdkafka/src/producer.h:80:8: warning: 'ActivateDispatchers' overrides a member function but is not marked 'override'
[-Winconsistent-missing-override]
void ActivateDispatchers();
^
project-root/node_modules/node-rdkafka/src/connection.h:66:16: note: overridden virtual function is here
virtual void ActivateDispatchers() = 0;
^
In file included from ../src/binding.cc:11:
In file included from project-root/node_modules/node-rdkafka/src/binding.h:21:
project-root/node_modules/node-rdkafka/src/producer.h:81:8: warning: 'DeactivateDispatchers' overrides a member function but is not marked 'override'
[-Winconsistent-missing-override]
void DeactivateDispatchers();
^
project-root/node_modules/node-rdkafka/src/connection.h:67:16: note: overridden virtual function is here
virtual void DeactivateDispatchers() = 0;
^
2 warnings generated.
CXX(target) Release/obj.target/node-librdkafka/src/callbacks.o
../src/callbacks.cc:103:8: warning: 'Call' is deprecated [-Wdeprecated-declarations]
cb.Call(_argc, _argv);
^
../../nan/nan.h:1741:3: note: 'Call' has been explicitly marked deprecated here
NAN_DEPRECATED inline v8::Local<v8::Value>
^
../../nan/nan.h:106:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
^
../src/callbacks.cc:569:48: warning: 'Call' is deprecated [-Wdeprecated-declarations]
v8::Local<v8::Value> return_value = callback.Call(3, argv);
^
../../nan/nan.h:1741:3: note: 'Call' has been explicitly marked deprecated here
NAN_DEPRECATED inline v8::Local<v8::Value>
^
../../nan/nan.h:106:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
^
../src/callbacks.cc:606:11: warning: 'operator()' is deprecated [-Wdeprecated-declarations]
callback(cb);
^
../../nan/nan.h:1640:3: note: 'operator()' has been explicitly marked deprecated here
NAN_DEPRECATED inline v8::Local<v8::Value> operator()(
^
../../nan/nan.h:106:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
^
3 warnings generated.
CXX(target) Release/obj.target/node-librdkafka/src/common.o
CXX(target) Release/obj.target/node-librdkafka/src/config.o
CXX(target) Release/obj.target/node-librdkafka/src/connection.o
In file included from ../src/connection.cc:14:
In file included from project-root/node_modules/node-rdkafka/src/workers.h:19:
project-root/node_modules/node-rdkafka/src/producer.h:80:8: warning: 'ActivateDispatchers' overrides a member function but is not marked 'override'
[-Winconsistent-missing-override]
void ActivateDispatchers();
^
project-root/node_modules/node-rdkafka/src/connection.h:66:16: note: overridden virtual function is here
virtual void ActivateDispatchers() = 0;
^
In file included from ../src/connection.cc:14:
In file included from project-root/node_modules/node-rdkafka/src/workers.h:19:
project-root/node_modules/node-rdkafka/src/producer.h:81:8: warning: 'DeactivateDispatchers' overrides a member function but is not marked 'override'
[-Winconsistent-missing-override]
void DeactivateDispatchers();
^
project-root/node_modules/node-rdkafka/src/connection.h:67:16: note: overridden virtual function is here
virtual void DeactivateDispatchers() = 0;
^
In file included from ../src/connection.cc:14:
project-root/node_modules/node-rdkafka/src/workers.h:42:15: warning: 'Call' is deprecated [-Wdeprecated-declarations]
callback->Call(argc, argv);
^
../../nan/nan.h:1741:3: note: 'Call' has been explicitly marked deprecated here
NAN_DEPRECATED inline v8::Local<v8::Value>
^
../../nan/nan.h:106:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
^
3 warnings generated.
CXX(target) Release/obj.target/node-librdkafka/src/errors.o
CXX(target) Release/obj.target/node-librdkafka/src/kafka-consumer.o
In file included from ../src/kafka-consumer.cc:14:
In file included from project-root/node_modules/node-rdkafka/src/workers.h:19:
project-root/node_modules/node-rdkafka/src/producer.h:80:8: warning: 'ActivateDispatchers' overrides a member function but is not marked 'override'
[-Winconsistent-missing-override]
void ActivateDispatchers();
^
................................
../../nan/nan.h:1741:3: note: 'Call' has been explicitly marked deprecated here
NAN_DEPRECATED inline v8::Local<v8::Value>
^
../../nan/nan.h:106:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
^
../src/workers.cc:986:13: warning: 'Call' is deprecated [-Wdeprecated-declarations]
callback->Call(argc, argv);
^
../../nan/nan.h:1741:3: note: 'Call' has been explicitly marked deprecated here
NAN_DEPRECATED inline v8::Local<v8::Value>
^
../../nan/nan.h:106:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
^
../src/workers.cc:995:13: warning: 'Call' is deprecated [-Wdeprecated-declarations]
callback->Call(argc, argv);
^
../../nan/nan.h:1741:3: note: 'Call' has been explicitly marked deprecated here
NAN_DEPRECATED inline v8::Local<v8::Value>
^
../../nan/nan.h:106:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
^
35 warnings generated.
CXX(target) Release/obj.target/node-librdkafka/src/admin.o
In file included from ../src/admin.cc:13:
In file included from project-root/node_modules/node-rdkafka/src/workers.h:19:
project-root/node_modules/node-rdkafka/src/producer.h:80:8: warning: 'ActivateDispatchers' overrides a member function but is not marked 'override'
[-Winconsistent-missing-override]
void ActivateDispatchers();
^
project-root/node_modules/node-rdkafka/src/connection.h:66:16: note: overridden virtual function is here
virtual void ActivateDispatchers() = 0;
^
In file included from ../src/admin.cc:13:
In file included from project-root/node_modules/node-rdkafka/src/workers.h:19:
project-root/node_modules/node-rdkafka/src/producer.h:81:8: warning: 'DeactivateDispatchers' overrides a member function but is not marked 'override'
[-Winconsistent-missing-override]
void DeactivateDispatchers();
^
project-root/node_modules/node-rdkafka/src/connection.h:67:16: note: overridden virtual function is here
virtual void DeactivateDispatchers() = 0;
^
In file included from ../src/admin.cc:13:
project-root/node_modules/node-rdkafka/src/workers.h:42:15: warning: 'Call' is deprecated [-Wdeprecated-declarations]
callback->Call(argc, argv);
^
../../nan/nan.h:1741:3: note: 'Call' has been explicitly marked deprecated here
NAN_DEPRECATED inline v8::Local<v8::Value>
^
../../nan/nan.h:106:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
^
3 warnings generated.
SOLINK_MODULE(target) Release/node-librdkafka.node