Delete libxmljs2 (builds fails on newer node) #1
yocontra posted onGitHub
Currently if you try to install this package the native extension for this dependency fails to build on node > 12.
PR on the base repo that fixes this: https://github.com/jaredhanson/passport-twitter/pull/108
That was fixed a long time ago we don't use xtraverse we use libxmljs2
@rwky Not sure why but a fresh install was failing for me with the same issue - let me check into it more and I'll bring back more info.
Can you provide the package.json you're using so I can try it out?
@rwky Issue is libxmljs2 doens't compile on latest node + macos - https://github.com/marudor/libxmljs2/issues/123. That being said - I think libxmljs2 is overkill for what passport-twitter needs. The response from twitter is fixed and known and the regex solution from that PR i linked in the original post here would solve the issue fine w/o needing a native dependency that needs to be constantly kept up to date w/ latest node.
⯠node -v
v16.6.1
⯠yarn add @passport-next/passport-twitter
yarn add v1.22.11
[1/5] š Validating package.json...
[2/5] š Resolving packages...
[3/5] š Fetching packages...
[4/5] š Linking dependencies...
[5/5] šØ Building fresh packages...
[-/2] ā” waiting...
error /Users/contra/Projects/createsafe-wallet/services/api/node_modules/libxmljs2: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build --loglevel http
Arguments:
Directory: /Users/contra/Projects/createsafe-wallet/services/api/node_modules/libxmljs2
Output:
node-pre-gyp http GET https://github.com/marudor/libxmljs2/releases/download/v0.26.7/node-v93-darwin-x64-unknown.tar.gz
node-pre-gyp ERR! install response status 404 Not Found on https://github.com/marudor/libxmljs2/releases/download/v0.26.7/node-v93-darwin-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not installable for libxmljs2@0.26.7 and node@16.6.1 (node-v93 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/marudor/libxmljs2/releases/download/v0.26.7/node-v93-darwin-x64-unknown.tar.gz
gyp info it worked if it ends with ok
gyp info using node-gyp@7.1.2
gyp info using node@16.6.1 | darwin | x64
gyp info ok
(node:61537) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
(Use `node --trace-deprecation ...` to show where the warning was created)
CXX(target) Release/obj.target/xmljs/src/libxmljs.o
In file included from ../src/libxmljs.cc:3:
In file included from /Users/contra/Library/Caches/node-gyp/16.6.1/include/node/v8.h:30:
/Users/contra/Library/Caches/node-gyp/16.6.1/include/node/v8-internal.h:488: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/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:776:50: note: 'remove_cv' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
^
1 error generated.
make: *** [Release/obj.target/xmljs/src/libxmljs.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/contra/.nvm/versions/node/v16.6.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (node:events:394:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Darwin 20.6.0
gyp ERR! command "/Users/contra/.nvm/versions/node/v16.6.1/bin/node" "/Users/contra/.nvm/versions/node/v16.6.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--loglevel=http" "--module=/Users/contra/Projects/createsafe-wallet/services/api/node_modules/libxmljs2/build/Release/xmljs.node" "--module_name=xmljs" "--module_path=/Users/contra/Projects/createsafe-wallet/services/api/node_modules/libxmljs2/build/Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v93"
gyp ERR! cwd /Users/contra/Projects/createsafe-wallet/services/api/node_modules/libxmljs2
gyp ERR! node -v v16.6.1
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/Users/contra/.nvm/versions/node/v16.6.1/bin/node /Users/contra/.nvm/versions/node/v16.6.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --loglevel=http --module=/Users/contra/Projects/createsafe-wallet/services/api/node_modules/libxmljs2/build/Release/xmljs.node --module_name=xmljs --module_path=/Users/contra/Projects/createsafe-wallet/services/api/node_modules/libxmljs2/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/contra/Projects/createsafe-wallet/services/api/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
node-pre-gyp ERR! stack at ChildProcess.emit (node:events:394:28)
node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1067:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
node-pre-gyp ERR! System Darwin 20.6.0
node-pre-gyp ERR! command "/Users/contra/.nvm/versions/node/v16.6.1/bin/node" "/Users/contra/Projects/createsafe-wallet/services/api/node_modules/libxmljs2/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--loglevel" "http"
node-pre-gyp ERR! cwd /Users/contra/Projects/createsafe-wallet/services/api/node_modules/libxmljs2
node-pre-gyp ERR! node -v v16.6.1
node-pre-gyp ERR! node-pre-gyp -v v1.0.5
node-pre-gyp ERR! not ok
Failed to execute '/Users/contra/.nvm/versions/node/v16.6.1/bin/node /Users/contra/.nvm/versions/node/v16.6.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --loglevel=http --module=/Users/contra/Projects/createsafe-wallet/services/api/node_modules/libxmljs2/build/Release/xmljs.node --module_name=xmljs --module_path=/Users/contra/Projects/createsafe-wallet/services/api/node_modules/libxmljs2/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
Hi, I'm having the same issue on macOS Monterey (12.0.1) on a project using Node.js 16.13.0. Any idea on what approach is preferred to resolve that?
I think it's reasonable to swap out libxmljs2 with JS standard lib functions if someone wants to open a PR please do!