npm -v): 6.9.0node -v): 10.16.3node -p process.versions): { http_parser: '2.8.0',
node: '10.16.3',
v8: '6.8.275.32-node.54',
uv: '1.28.0',
zlib: '1.2.11',
brotli: '1.0.7',
ares: '1.15.0',
modules: '64',
nghttp2: '1.39.2',
napi: '4',
openssl: '1.1.1c',
icu: '64.2',
unicode: '12.1',
cldr: '35.1',
tz: '2019a' }
node -p process.platform): openbsdnode -p process.arch): x64node -p "require('node-sass').info"): n/anpm ls node-sass): n/aGet the following build errors when I check out the node-sass repo and attempt an npm install:
npm WARN deprecated [email protected]: This module is no longer maintained, try thi
s instead:
npm WARN deprecated npm i nyc
npm WARN deprecated Visit https://istanbul.js.org/integrations for other alterna
tives.
npm WARN deprecated [email protected]: Please use the native JSON object instead of JS
ON 3
npm WARN deprecated [email protected]: CircularJSON is in maintenance only, fl
atted is its successor.
> [email protected] install /home/username/Projects/node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.1
3.1/openbsd-x64-64_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.13.1/ope
nbsd-x64-64_binding.node":
HTTP error 404 Not Found
Hint: If github.com is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.
export HTTP_PROXY=http://example.com:1234
or configure npm proxy via
npm config set proxy http://example.com:8080
> [email protected] postinstall /home/username/Projects/node-sass
> node scripts/build.js
Building: /usr/local/bin/node /home/username/Projects/node-sass/node_modules/no
de-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libs
ass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ '/usr/local/bin/node',
gyp verb cli '/home/username/Projects/node-sass/node_modules/node-gyp/bin/nod
e-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library=' ]
gyp info using [email protected]
gyp info using [email protected] | openbsd | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` succeeded python2 /usr/local/bin/python2
gyp verb check python version `/usr/local/bin/python2 -c "import sys; print "2.7
.16
gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
gyp verb get node dir no --target version specified, falling back to host node v
ersion: 10.16.3
gyp verb command install [ '10.16.3' ]
gyp verb install input version string "10.16.3"
gyp verb install installing version: 10.16.3
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 10.16.3
gyp verb build dir attempting to create "build" dir: /home/username/Projects/no
de-sass/build
gyp verb build dir "build" dir needed to be created? /home/username/Projects/no
de-sass/build
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: /home/username/Projects/nod
e-sass/build/config.gypi
gyp verb config.gypi checking for gypi file: /home/username/Projects/node-sass/
config.gypi
gyp verb common.gypi checking for gypi file: /home/username/Projects/node-sass/
common.gypi
gyp verb gyp gyp format was not specified; forcing "make"
gyp info spawn /usr/local/bin/python2
gyp info spawn args [ '/home/username/Projects/node-sass/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 '/home/username/Projects/node-sass/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/username/Projects/node-sass/node_modules/node-gyp/
addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/username/.node-gyp/10.16.3/include/node/common.gyp
i',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/home/username/.node-gyp/10.16.3',
gyp info spawn args '-Dnode_gyp_dir=/home/username/Projects/node-sass/node_mo
dules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/home/username/.node-gyp/10.16.3/<(targe
t_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/home/username/Projects/node-sass',
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 verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir /home/username/.node-gyp/10.16.3
gyp verb `which` succeeded for `gmake` /usr/local/bin/gmake
gyp info spawn gmake
gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
gmake: Entering directory '/home/username/Projects/node-sass/build'
g++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=
1' '-DV8_DEPRECATION_WARNINGS=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64'
'-DLIBSASS_VERSION="3.5.4"' -I/home/username/.node-gyp/10.16.3/include/node -I/
home/username/.node-gyp/10.16.3/src -I/home/username/.node-gyp/10.16.3/deps/op
enssl/config -I/home/username/.node-gyp/10.16.3/deps/openssl/openssl/include -I
/home/username/.node-gyp/10.16.3/deps/uv/include -I/home/username/.node-gyp/10
.16.3/deps/zlib -I/home/username/.node-gyp/10.16.3/deps/v8/include -I../src/lib
sass/include -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -I/usr/loc
al/include -O3 -fno-omit-frame-pointer -std=gnu++1y -std=c++0x -fexceptions -frt
ti -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/ast.o.d.r
aw -c -o Release/obj.target/libsass/src/libsass/src/ast.o ../src/libsass/src/a
st.cpp
cc1plus: error: unrecognized command line option "-std=gnu++1y"
cc1plus: error: unrecognized command line option "-std=c++0x"
gmake: *** [src/libsass.target.mk:152: Release/obj.target/libsass/src/libsass/sr
c/ast.o] Error 1
gmake: Leaving directory '/home/username/Projects/node-sass/build'
gyp ERR! build error
gyp ERR! stack Error: `gmake` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/username/Projects/node-sass/no
de_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:248:12)
gyp ERR! System OpenBSD 6.6
gyp ERR! command "/usr/local/bin/node" "/home/username/Projects/node-sass/node_
modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libs
ass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/username/Projects/node-sass
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/username/.npm/_logs/2020-01-31T21_14_48_905Z-debug.log
libsass 3.6.1 is available via pkg_add libsass, but I see that libsass 3.6 support (#2685) is not due until version 5.x (#2111).
Sorry, OpenBSD isn't a platform we support
Let me help you anyway - node-sass releases are tightly bound to some corresponding libsass version. I would advice against trying to build node-sass binding against pre-installed library from OpenBSD ports unless you are 100% sure you have the matching libsass version. (package.json file contains this information if there are no slip-ups like #2621). There are flags to do this if you like - just check my experimental FreeBSD port tree at https://github.com/saper/ports-exp/tree/master/textproc/node-sass
Your particular problem here is the compiler. What is the g++ version you are using right now?
@saper Thank you for your time! I was just exploring the g++ versions available on OpenBSD due to the errors and it appears that g++ 4.2.1 (so pre-C++11) is in base, though g++ 8.3.0 is available in ports as eg++.
I found your instructions on Clang Support on FreeBSD and tried a CXX=clang++ npm install. That seemed to work.
Hi,
On OpenBSD you need to use clang++ (CXX=/usr/bin/clang++):
$ env CXX=/usr/bin/clang++ npm install node-sass
$ node
> var s = require('node-sass');
undefined
> console.log(s.info)
node-sass 4.13.1 (Wrapper) [JavaScript]
libsass 3.5.4 (Sass Compiler) [C/C++]
undefined
> process.versions
{ http_parser: '2.8.0',
node: '10.18.0',
v8: '6.8.275.32-node.54',
uv: '1.28.0',
zlib: '1.2.11',
brotli: '1.0.7',
ares: '1.15.0',
modules: '64',
nghttp2: '1.39.2',
napi: '5',
openssl: '1.1.1d',
icu: '64.2',
unicode: '12.1',
cldr: '35.1',
tz: '2019a' }
>
Thanks @qbit, I had just found that.
Great - if someone from OpenBSD community would like to prepare a port and build binaries, we could add them to the official matrix - this way a proper binary will be downloaded automatically via npm without the need to compile anything.
Important: please use the same C++11 compiler that has been used to compile node itself to avoid runtime C++ ABI incompatibilities.
Yes - please add support someone. OpenBSD is years ahead of any other Unix-based platform, period.
Thanks @morgant and @qbit for your insights.
People don't forget to add this to your /etc/zprofile (Zsh):
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
@ratahtatah I would avoid setting them globally, doing so will force everything to use clang, not just npm.
A better alternative would be to make an npm alias, something like:
alias npm='env CXX=/usr/bin/clang++ npm'
That way only npm will be impacted.
This problem is back you guys: https://github.com/sass/node-sass/issues/2916
@anon987654321 This is because we do not distribute OpenBSD binaries with the node-sass releases. See also https://github.com/sass/node-sass/pull/2885#issuecomment-609063717
The fix is here: https://marc.info/?l=openbsd-ports&m=160657052927238
ln -s /usr/local/bin/node /tmp/node
Don't forget to replace gcc with clang:
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
Shoutout to Solene for the help.
Most helpful comment
Hi,
On OpenBSD you need to use clang++ (
CXX=/usr/bin/clang++):