timse / srcset-loader

Flexible srcset-loader for webpack
46 stars 14 forks source link

Sharp command failed; #30

Closed tettoffensive closed 4 years ago

tettoffensive commented 4 years ago

Not sure what's going on, but when I do: yarn add srcset-loader --dev

It fails, even though yarn add sharp --dev works. Maybe the version? Installing it straight uses version ^0.24.1

[12/12] ⠄ sharp
error /XXX/node_modules/sharp: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /XXX/node_modules/sharp
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@5.0.7
gyp info using node@13.8.0 | darwin | x64
gyp info find Python using Python version 2.7.16 found at "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python"
gyp info spawn /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
gyp info spawn args [
gyp info spawn args   '/usr/local/Cellar/node/13.8.0/libexec/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/XXX/node_modules/sharp/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/Cellar/node/13.8.0/libexec/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/XXX/Caches/node-gyp/13.8.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/XXX/Library/Caches/node-gyp/13.8.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/Cellar/node/13.8.0/libexec/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/XXX/Library/Caches/node-gyp/13.8.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/XXXb/node_modules/sharp',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  TOUCH Release/obj.target/libvips-cpp.stamp
  CXX(target) Release/obj.target/sharp/src/common.o
In file included from ../src/common.cc:27:
../src/common.h:80:20: error: no member named 'Handle' in namespace 'v8'
  bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
               ~~~~^
../src/common.h:80:37: error: expected '(' for function-style cast or type construction
  bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
                          ~~~~~~~~~~^
../src/common.h:80:39: error: use of undeclared identifier 'obj'
  bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
                                      ^
../src/common.h:80:56: error: expected '(' for function-style cast or type construction
  bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
                                           ~~~~~~~~~~~ ^
../src/common.h:81:29: error: no member named 'Handle' in namespace 'v8'
  std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr);
                        ~~~~^
../src/common.h:81:46: error: expected '(' for function-style cast or type construction
  std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr);
                                   ~~~~~~~~~~^
../src/common.h:81:48: error: use of undeclared identifier 'obj'
  std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr);
                                               ^
../src/common.h:81:65: error: expected '(' for function-style cast or type construction
  std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr);
                                                    ~~~~~~~~~~~ ^
../src/common.h:82:37: warning: variable templates are a C++14 extension [-Wc++14-extensions]
  template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
                                    ^
../src/common.h:82:48: error: no member named 'Handle' in namespace 'v8'
  template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
                                           ~~~~^
../src/common.h:82:65: error: expected '(' for function-style cast or type construction
  template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
                                                      ~~~~~~~~~~^
../src/common.h:82:67: error: use of undeclared identifier 'obj'
  template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
                                                                  ^
../src/common.h:82:84: error: expected '(' for function-style cast or type construction
  template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
                                                                       ~~~~~~~~~~~ ^
../src/common.h:82:89: error: expected ';' at end of declaration
  template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
                                                                                        ^
                                                                                        ;
../src/common.h:82:90: error: expected unqualified-id
  template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
                                                                                         ^
../src/common.h:85:26: warning: variable templates are a C++14 extension [-Wc++14-extensions]
  template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
                         ^
../src/common.h:85:37: error: no member named 'Handle' in namespace 'v8'
  template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
                                ~~~~^
../src/common.h:85:54: error: expected '(' for function-style cast or type construction
  template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
                                           ~~~~~~~~~~^
../src/common.h:85:56: error: use of undeclared identifier 'obj'
  template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
                                                       ^
../src/common.h:85:73: error: expected '(' for function-style cast or type construction
  template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
                                                            ~~~~~~~~~~~ ^
../src/common.h:85:78: error: expected ';' at end of declaration
  template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
                                                                             ^
                                                                             ;
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
make: *** [Release/obj.target/sharp/src/common.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/Cellar/node/13.8.0/libexec/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:321:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.4.0
gyp ERR! command "/usr/local/Cellar/node/13.8.0/bin/node" "/usr/local/Cellar/node/13.8.0/libexec/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /XXX/node_modules/sharp
tettoffensive commented 4 years ago

Looks like the answer is here: https://github.com/yarnpkg/yarn/issues/6617

yarn and npm are using different versions of node. And it seems to effect sub-dependencies.

npm config set scripts-prepend-node-path true