我尝试按照blk-design-system-react documentation中的说明将src/assets
目录添加到应用程序assets
的子目录src
中,然后将以下内容添加到我的App.js顶部:
import "assets/scss/blk-design-system-react.scss";
import "assets/css/nucleo-icons.css";
然后
<!-- Fonts and icons -->
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700,200" rel="stylesheet" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css" />
在我的index.html标记中,但是对于使用create-react-app
创建的基本应用而言,主题没有改变。
然后,我用nvm v12.4.0, npm 6.9.0, node-sass@4.12.0, node-gyp@3.8.0, GPP 2.24, GNU Make 3.81
尝试使用npm i blk-design-system-react
并遇到以下错误:
../src/create_string.cpp: In function ‘char* create_string(Nan::MaybeLocal<v8::Value>)’:
../src/create_string.cpp:17:37: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>&)’
v8::String::Utf8Value string(value);
^
../src/create_string.cpp:17:37: note: candidate is:
In file included from /home/wbkboyer/.node-gyp/12.4.0/include/node/node.h:63:0,
from ../../../../nan/nan.h:54,
from ../src/create_string.cpp:1:
/home/wbkboyer/.node-gyp/12.4.0/include/node/v8.h:2995:5: note: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>)
Utf8Value(Isolate* isolate, Local<v8::Value> obj);
^
/home/wbkboyer/.node-gyp/12.4.0/include/node/v8.h:2995:5: note: candidate expects 2 arguments, 1 provided
make: *** [Release/obj.target/binding/src/create_string.o] Error 1
make: Leaving directory `/home/wbkboyer/git/locomath/locomath-app/node_modules/blk-design-system-react/node_modules/node-sass/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/wbkboyer/git/locomath/locomath-app/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:200:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 3.19.0-32-generic
gyp ERR! command "/home/wbkboyer/.nvm/versions/node/v12.4.0/bin/node" "/home/wbkboyer/git/locomath/locomath-app/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/wbkboyer/git/locomath/locomath-app/node_modules/blk-design-system-react/node_modules/node-sass
gyp ERR! node -v v12.4.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
主要错误似乎是基于node-gyp
的地方
../src/create_string.cpp:17:37: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>&)’
v8::String::Utf8Value string(value);
...
/home/wbkboyer/.node-gyp/12.4.0/include/node/v8.h:2995:5: note: candidate expects 2 arguments, 1 provided
我在nvm 12.5.0
和npm 6.9.0
的最新版本等方面遇到了相同的问题。
TL; DR如何在新的React项目中安装和使用node-sass
或与此相关的任何主题?感谢您的时间和帮助!
编辑:我认为我会包括一些链接,这些链接显示出与我观察到的相同的错误:
答案 0 :(得分:0)
好吧,回答我问题的第一部分,这些步骤实际上确实改变了字体和样式。我必须构建一个组件以查看实际情况。我仍然看不到npm install
作为主题的目的是……感谢您的阅读!