Sass

Sass

1 件の記事が見付かりました。
  • node-sass: OpenBSD でビルドエラー - 解決方法

    @nabbisen

    事象

    npm install node-sassOpenBSD で実行すると、次のようなエラーが出ることがあります。

    > [email protected] postinstall $APP_DIR/node_modules/node-sass
    > node scripts/build.js
    
    Building: node $APP_DIR/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
    gyp info it worked if it ends with ok
    gyp info using [email protected]
    gyp info using [email protected] | openbsd | x64
    gyp http GET https://nodejs.org/download/release/v12.16.1/node-v12.16.1-headers.tar.gz
    gyp http 200 https://nodejs.org/download/release/v12.16.1/node-v12.16.1-headers.tar.gz
    gyp http GET https://nodejs.org/download/release/v12.16.1/SHASUMS256.txt
    gyp http 200 https://nodejs.org/download/release/v12.16.1/SHASUMS256.txt
    gyp info spawn /usr/local/bin/python2
    gyp info spawn args [
    gyp info spawn args   '$APP_DIR/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   '$APP_DIR/node_modules/node-sass/build/config.gypi',
    gyp info spawn args   '-I',
    gyp info spawn args   '$APP_DIR/node_modules/node-gyp/addon.gypi',
    gyp info spawn args   '-I',
    gyp info spawn args   '$HOME_DIR/.node-gyp/12.16.1/include/node/common.gypi',
    gyp info spawn args   '-Dlibrary=shared_library',
    gyp info spawn args   '-Dvisibility=default',
    gyp info spawn args   '-Dnode_root_dir=$HOME_DIR/.node-gyp/12.16.1',
    gyp info spawn args   '-Dnode_gyp_dir=$APP_DIR/node_modules/node-gyp',
    gyp info spawn args   '-Dnode_lib_file=$HOME_DIR/.node-gyp/12.16.1/<(target_arch)/node.lib',
    gyp info spawn args   '-Dmodule_root_dir=$APP_DIR/node_modules/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 info spawn args ]
    gyp info spawn gmake
    gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
    gmake: Entering directory '$APP_DIR/node_modules/node-sass/build'
      g++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DLIBSASS_VERSION="3.5.4"' -I$HOME_DIR/.node-gyp/12.16.1/include/node -I$HOME_DIR/.node-gyp/12.16.1/src -I$HOME_DIR/.node-gyp/12.16.1/deps/openssl/config -I$HOME_DIR/.node-gyp/12.16.1/deps/openssl/openssl/include -I$HOME_DIR/.node-gyp/12.16.1/deps/uv/include -I$HOME_DIR/.node-gyp/12.16.1/deps/zlib -I$HOME_DIR/.node-gyp/12.16.1/deps/v8/include -I../src/libsass/include  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -I/usr/local/include -O3 -fno-omit-frame-pointer -std=gnu++1y -std=c++0x -fexceptions -frtti -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/ast.o.d.raw   -c -o Release/obj.target/libsass/src/libsass/src/ast.o ../src/libsass/src/ast.cpp
    cc1plus: error: unrecognized command line option "-std=gnu++1y"
    cc1plus: error: unrecognized command line option "-std=c++0x"
    gmake: *** [src/libsass.target.mk:162: Release/obj.target/libsass/src/libsass/src/ast.o] Error 1
    gmake: Leaving directory '$APP_DIR/node_modules/node-sass/build'
    gyp ERR! build error 
    gyp ERR! stack Error: `gmake` failed with exit code: 2
    gyp ERR! stack     at ChildProcess.onExit ($APP_DIR/node_modules/node-gyp/lib/build.js:262:23)
    gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
    gyp ERR! System OpenBSD 6.7
    gyp ERR! command "node" "$APP_DIR/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
    gyp ERR! cwd $APP_DIR/node_modules/node-sass
    gyp ERR! node -v v12.16.1
    gyp ERR! node-gyp -v v3.8.0
    gyp ERR! not ok 
    Build failed with error code: 1
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"openbsd","arch":"x64"})
    
    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 logging output above.
    

    環境

    • OS: OpenBSD 7.0
    • App: Node.js 12.22

    解決方法

    clang++ が必要なところで g++ が使われるためにエラーが発生します。 そのようなわけですので、次のようにすると解決できます:

    ...

    読む