代码之家  ›  专栏  ›  技术社区  ›  Blaine Lafreniere

yarn install——检查那些我不理解的错误输出文件

  •  0
  • Blaine Lafreniere  · 技术社区  · 5 年前

    我有一个Ruby on Rails项目,我正在一个新设置的服务器上部署。

    我运行命令 rails s -b 0.0.0.0 它说:

    ========================================
      Your Yarn packages are out of date!
      Please run `yarn install --check-files` to update.
    ========================================
    

    因此,我运行了它告诉我运行的命令,但最终它失败了,并出现了一些我并不真正理解的错误:

      g++ '-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_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' -I/home/ubuntu/.node-gyp/16.0.0/include/node -I/home/ubuntu/.node-gyp/16.0.0/src -I/home/ubuntu/.node-gyp/16.0.0/deps/openssl/config -I/home/ubuntu/.node-gyp/16.0.0/deps/openssl/openssl/include -I/home/ubuntu/.node-gyp/16.0.0/deps/uv/include -I/home/ubuntu/.node-gyp/16.0.0/deps/zlib -I/home/ubuntu/.node-gyp/16.0.0/deps/v8/include -I../../nan -I../src/libsass/include  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -std=c++0x -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 /home/ubuntu/.node-gyp/16.0.0/include/node/v8.h:30,
                     from /home/ubuntu/.node-gyp/16.0.0/include/node/node.h:63,
                     from ../../nan/nan.h:56,
                     from ../src/binding.cpp:1:
    /home/ubuntu/.node-gyp/16.0.0/include/node/v8-internal.h: In function ‘void v8::internal::PerformCastCheck(T*)’:
    /home/ubuntu/.node-gyp/16.0.0/include/node/v8-internal.h:452:38: error: ‘remove_cv_t’ is not a member of ‘std’; did you mean ‘remove_cv’?
      452 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
          |                                      ^~~~~~~~~~~
          |                                      remove_cv
    /home/ubuntu/.node-gyp/16.0.0/include/node/v8-internal.h:452:38: error: ‘remove_cv_t’ is not a member of ‘std’; did you mean ‘remove_cv’?
      452 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
          |                                      ^~~~~~~~~~~
          |                                      remove_cv
    /home/ubuntu/.node-gyp/16.0.0/include/node/v8-internal.h:452:50: error: template argument 2 is invalid
      452 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
          |                                                  ^
    /home/ubuntu/.node-gyp/16.0.0/include/node/v8-internal.h:452:63: error: ‘::Perform’ has not been declared
      452 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
          |                                                               ^~~~~~~
    ../src/binding.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE render(Nan::NAN_METHOD_ARGS_TYPE)’:
    ../src/binding.cpp:284:98: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
      284 |     int status = uv_queue_work(uv_default_loop(), &ctx_w->request, compile_it, (uv_after_work_cb)MakeCallback);
          |                                                                                                  ^~~~~~~~~~~~
    ../src/binding.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE render_file(Nan::NAN_METHOD_ARGS_TYPE)’:
    ../src/binding.cpp:320:98: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
      320 |     int status = uv_queue_work(uv_default_loop(), &ctx_w->request, compile_it, (uv_after_work_cb)MakeCallback);
          |                                                                                                  ^~~~~~~~~~~~
    In file included from ../../nan/nan.h:56,
                     from ../src/binding.cpp:1:
    ../src/binding.cpp: At global scope:
    /home/ubuntu/.node-gyp/16.0.0/include/node/node.h:806:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
      806 |       (node::addon_register_func) (regfunc),                          \
          |                                           ^
    /home/ubuntu/.node-gyp/16.0.0/include/node/node.h:840:3: note: in expansion of macro ‘NODE_MODULE_X’
      840 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
          |   ^~~~~~~~~~~~~
    ../src/binding.cpp:358:1: note: in expansion of macro ‘NODE_MODULE’
      358 | NODE_MODULE(binding, RegisterModule);
          | ^~~~~~~~~~~
    make: *** [binding.target.mk:133: 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 (/home/ubuntu/vendsmartsolutions/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 Linux 5.4.0-1038-aws
    gyp ERR! command "/home/ubuntu/.nvm/versions/node/v16.0.0/bin/node" "/home/ubuntu/vendsmartsolutions/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
    gyp ERR! cwd /home/ubuntu/vendsmartsolutions/node_modules/node-sass
    gyp ERR! node -v v16.0.0
    gyp ERR! node-gyp -v v3.8.0
    gyp ERR! not ok 
    make: Leaving directory '/home/ubuntu/vendsmartsolutions/node_modules/node-sass/build'
    Build failed with error code: 1
    

    我看了几遍,真的不知道这意味着什么。这个项目在我的开发虚拟机上运行良好。

    任何帮助都将不胜感激,谢谢。

    0 回复  |  直到 5 年前
        1
  •  6
  •   LuckyWind_sck    5 年前

    这似乎是nodeJS版本的问题。

    我尝试了节点v15,它对我有效,而v16会失败。

    此外,node-sass已被弃用。你应该换一个库来使用。

        2
  •  4
  •   stevec Zxeenu    5 年前

    更新: this 是什么解决了我和 @S.Goswami 。请先试试那个解决方案。

    如果上述解决方案不起作用,可能值得尝试推荐的解决方案 here ,但不幸的是,这对我或对 others ,但如果上述解决方案不起作用,可能值得一试。以下是对一些人有效的解决方案的概述,但是 不 大家:

    1. 删除 yarn.lock
    2. rails应用程序的根目录中有一个名为 node_modules -删除它。注意:如果你使用崇高的文本,它不会显示简单的目录 "house source control information and various binary output files" (吸取的教训)。打开你的应用程序 在finder中 ,查找 yourapp/node_modules/ 并将其删除。
    3. 快跑 spring stop (我不需要这样做,但其他人建议这样做,这不会有什么坏处)。
    4. 现在,只需使用以下命令重新安装节点模块 yarn install . 但是 ,如果此步骤出错,请尝试使用 yarn install -std=c++17 正如在帮助中发现的那样 comments 和@Scheff的 answer
        3
  •  2
  •   Zeeshan Ali    5 年前

    节点sass 目前还不支持Node v16。因此,目前将Node降级到v15将修复这些错误。如需更多更新,请访问 sass/node-sass#3077