gpt4 book ai didi

node.js - 错误 : no template named 'remove_cv_t' in namespace 'std' ; did you mean 'remove_cv' ?

转载 作者:行者123 更新时间:2023-12-04 04:26:11 29 4
gpt4 key购买 nike

我的问题似乎类似于 this问题,除非它发生在我运行 yarn install 时在 Rails 应用程序中。
当我跑 yarn install ,它成功运行了一段时间,然后

../src/libsass/src/ast.hpp:1614:25: warning: loop variable 'numerator' of type 'const std::__1::basic_string<char>' creates a copy from type 'const std::__1::basic_string<char>' [-Wrange-loop-analysis]
for (const auto numerator : numerators)
^
../src/libsass/src/ast.hpp:1614:14: note: use reference type 'const std::__1::basic_string<char> &' to prevent copying
for (const auto numerator : numerators)
^~~~~~~~~~~~~~~~~~~~~~
&
../src/libsass/src/ast.hpp:1616:25: warning: loop variable 'denominator' of type 'const std::__1::basic_string<char>' creates a copy from type 'const std::__1::basic_string<char>' [-Wrange-loop-analysis]
for (const auto denominator : denominators)
^
../src/libsass/src/ast.hpp:1616:14: note: use reference type 'const std::__1::basic_string<char> &' to prevent copying
for (const auto denominator : denominators)
^~~~~~~~~~~~~~~~~~~~~~~~
&
2 warnings generated.
rm -f Release/sass.a && ./gyp-mac-tool filter-libtool libtool -static -o Release/sass.a Release/obj.target/libsass/src/libsass/src/ast.o Release/obj.target/libsass/src/libsass/src/ast_fwd_decl.o Release/obj.target/libsass/src/libsass/src/backtrace.o Release/obj.target/libsass/src/libsass/src/base64vlq.o Release/obj.target/libsass/src/libsass/src/bind.o Release/obj.target/libsass/src/libsass/src/cencode.o Release/obj.target/libsass/src/libsass/src/check_nesting.o Release/obj.target/libsass/src/libsass/src/color_maps.o Release/obj.target/libsass/src/libsass/src/constants.o Release/obj.target/libsass/src/libsass/src/context.o Release/obj.target/libsass/src/libsass/src/cssize.o Release/obj.target/libsass/src/libsass/src/emitter.o Release/obj.target/libsass/src/libsass/src/environment.o Release/obj.target/libsass/src/libsass/src/error_handling.o Release/obj.target/libsass/src/libsass/src/eval.o Release/obj.target/libsass/src/libsass/src/expand.o Release/obj.target/libsass/src/libsass/src/extend.o Release/obj.target/libsass/src/libsass/src/file.o Release/obj.target/libsass/src/libsass/src/functions.o Release/obj.target/libsass/src/libsass/src/inspect.o Release/obj.target/libsass/src/libsass/src/json.o Release/obj.target/libsass/src/libsass/src/lexer.o Release/obj.target/libsass/src/libsass/src/listize.o Release/obj.target/libsass/src/libsass/src/memory/SharedPtr.o Release/obj.target/libsass/src/libsass/src/node.o Release/obj.target/libsass/src/libsass/src/operators.o Release/obj.target/libsass/src/libsass/src/output.o Release/obj.target/libsass/src/libsass/src/parser.o Release/obj.target/libsass/src/libsass/src/plugins.o Release/obj.target/libsass/src/libsass/src/position.o Release/obj.target/libsass/src/libsass/src/prelexer.o Release/obj.target/libsass/src/libsass/src/remove_placeholders.o Release/obj.target/libsass/src/libsass/src/sass.o Release/obj.target/libsass/src/libsass/src/sass2scss.o Release/obj.target/libsass/src/libsass/src/sass_context.o Release/obj.target/libsass/src/libsass/src/sass_functions.o Release/obj.target/libsass/src/libsass/src/sass_util.o Release/obj.target/libsass/src/libsass/src/sass_values.o Release/obj.target/libsass/src/libsass/src/source_map.o Release/obj.target/libsass/src/libsass/src/subset_map.o Release/obj.target/libsass/src/libsass/src/to_c.o Release/obj.target/libsass/src/libsass/src/to_value.o Release/obj.target/libsass/src/libsass/src/units.o Release/obj.target/libsass/src/libsass/src/utf8_string.o Release/obj.target/libsass/src/libsass/src/util.o Release/obj.target/libsass/src/libsass/src/values.o
c++ '-DNODE_GYP_MODULE_NAME=binding' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/Users/st/.node-gyp/16.0.0/include/node -I/Users/st/.node-gyp/16.0.0/src -I/Users/st/.node-gyp/16.0.0/deps/openssl/config -I/Users/st/.node-gyp/16.0.0/deps/openssl/openssl/include -I/Users/st/.node-gyp/16.0.0/deps/uv/include -I/Users/st/.node-gyp/16.0.0/deps/zlib -I/Users/st/.node-gyp/16.0.0/deps/v8/include -I../../nan -I../src/libsass/include -O3 -gdwarf-2 -mmacosx-version-min=10.7 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=c++11 -stdlib=libc++ -fno-rtti -fno-exceptions -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/binding/src/binding.o.d.raw -c -o Release/obj.target/binding/src/binding.o ../src/binding.cpp
In file included from ../src/binding.cpp:1:
In file included from ../../nan/nan.h:56:
In file included from /Users/st/.node-gyp/16.0.0/include/node/node.h:63:
In file included from /Users/st/.node-gyp/16.0.0/include/node/v8.h:30:
/Users/st/.node-gyp/16.0.0/include/node/v8-internal.h:452:38: error: no template named 'remove_cv_t' in namespace 'std'; did you mean 'remove_cv'?
!std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
~~~~~^~~~~~~~~~~
remove_cv
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:697:50: note: 'remove_cv' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
^
1 error generated.
make: *** [Release/obj.target/binding/src/binding.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/st/rails/myapp/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (node:events:365:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Darwin 20.3.0
gyp ERR! command "/usr/local/Cellar/node/16.0.0/bin/node" "/Users/st/rails/myapp/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/st/rails/myapp/node_modules/node-sass
gyp ERR! node -v v16.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
任何想法如何解决这个问题? (我什至不确定 xcode/node/rails/c++ 是否有问题)
其他注意事项
  • /usr/bin/xcodebuild -version返回
  • Xcode 12.4
    Build version 12D4e
  • cpp --version返回
  • Apple clang version 12.0.0 (clang-1200.0.32.29)
    Target: x86_64-apple-darwin20.3.0
    Thread model: posix
    InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    请注意:我不在 cpp 中编码,所以我对如何解决的上下文知识知之甚少。

    最佳答案

    更新 :从 node-sass 版本 6.0.1 开始,支持 Node 16。将 node-sass 更新到 6.0.1 以上的版本可以解决这个问题。

    您看到的是 node-sass 编译期间的错误。这是一个处理你的 Sass/SCSS 样式的包,它是用 C++ 编写的,并且只重新打包为一个 JavaScript 库。它是用 C++ 编写的,这意味着它需要在安装期间在您的设备上编译(这是由一个名为 node-gyp 的工具在内部完成的,您也可以在错误输出中找到它)。
    问题是 node-sass 不支持 Node 16 在撰写此答案时,请参阅跟踪问题:https://github.com/sass/node-sass/issues/3077没有估计它什么时候会支持它(这是公平的,因为它是一个志愿者驱动的项目)。即使您设法在 Node 16 上安装 node-sass,我也建议您不要这样做,因为该行为可能未定义。
    正确的解决方法是将您的 Node 安装降级到受支持的版本 (我可以看到 14 和 15 在他们的 CI 中进行了测试)。如果您 git 克隆了一个项目并且它不会安装在您的机器上,但可以为您的同事或生产服务器工作,则该项目可能也考虑了不同版本的 Node,并且未在 Node 16 上进行测试,所以我建议不要在 Node 16 上开发它。如果该项目几天前对您有用,但现在不起作用,则很可能您最近升级了系统设置(例如 Homebrew),将您升级到 Node 16(这就是发生在我身上的事情以及我的方式发现这个问题)。
    您应该与项目的作者核实它运行的 Node 的生产服务器版本是什么,并在本地安装该版本。作为最佳实践,将来保持生产版本和您本地版本的 Node(以及 yarn 或 npm)同步。要管理多个 Node 版本,您可以使用此工具 https://github.com/nvm-sh/nvm

    关于node.js - 错误 : no template named 'remove_cv_t' in namespace 'std' ; did you mean 'remove_cv' ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67241196/

    29 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com