微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

macOS 和旧的 node-gyp 构建缓存反复出现的问题

如何解决macOS 和旧的 node-gyp 构建缓存反复出现的问题

这是我关于此问题的最新示例。如果我能得到一个关于为什么会发生这种情况的详细答案并快速解决类似的问题,那将是最佳选择,但我会高兴地解决这个特定问题。

我正在尝试使用 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 缓存、节点缓存、ext.),我相信我摆脱了这个问题。现在我没有看到那个错误。但是,我仍然看到所有相同的错误和警告,并且生成的构建似乎仍然被破坏。在这文章底部,我将添加我收到的相当大的错误消息。以下是我一直在使用的一些命令来尝试解决该问题。

#  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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。