我正在使用的WordPress初学者主题-https://github.com/roots/sage。
从今天开始,当我运行Yarn构建(webpack--progress--config/webpack.config.js)时,出现这个错误:* * 模块构建失败:模块构建错误:模块构建失败:错误:节点Sass尚不支持您当前的环境:OS X 64位,运行时不受支持(72)有关支持哪些环境的详细信息,请参阅:https://github.com/sass/node-sass/releases/tag/v4.8.3**
我也尝试卸载和重新安装节点,npm & yarn与brew,但没有任何变化。
如果我运行 * npm install *,则会出现此错误
../src/create_string.cpp:17:25: error: no matching constructor for initialization of 'v8::String::Utf8Value'
v8::String::Utf8Value string(value);
^ ~~~~~
/Users/MYPC/.node-gyp/12.1.0/include/node/v8.h:3002:5: note: candidate constructor not viable: no known conversion from 'v8::Local<v8::Value>' to 'const v8::String::Utf8Value'
for 1st argument
Utf8Value(const Utf8Value&) = delete;
^
/Users/MYPC/.node-gyp/12.1.0/include/node/v8.h:2995:5: note: candidate constructor not viable: requires 2 arguments, but 1 was provided
Utf8Value(Isolate* isolate, Local<v8::Value> obj);
^
1 error generated.
make: *** [Release/obj.target/binding/src/create_string.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/MYPC/mysiteteam/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:196:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:256:12)
gyp ERR! System Darwin 18.5.0
gyp ERR! command "/usr/local/Cellar/node/12.1.0/bin/node" "/Users/MYPC/mysiteteam/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/MYPC/mysiteteam/node_modules/node-sass
gyp ERR! node -v v12.1.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN stylelint-webpack-plugin@0.10.5 requires a peer of webpack@^1.13.2 || ^2.7.0 || ^3.11.0 || ^4.4.0 but none is installed. You must install peer dependencies yourself.
npm WARN ajv-keywords@2.1.1 requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! **node-sass@4.9.4 postinstall: `node scripts/build.js`**
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.9.4 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/MYPC/.npm/_logs/2019-05-03T16_22_30_277Z-debug.log
所以我尝试用这个命令行重建node-sass***npm rebuild node-sass--force***但是错误是一样的!!!
更多信息
Macos莫哈韦版本10.14.4
2.7 GHz英特尔酷睿i7
npm-v
6.9.0
节点-v
版本12.1.0
Yarn-v
1.15.2
package.json依赖项
"devDependencies": {
"autoprefixer": "~8.2.0",
"browser-sync": "~2.24.7",
"browsersync-webpack-plugin": "^0.6.0",
"bs-html-injector": "~3.0",
"buble-loader": "^0.4.1",
"cache-loader": "~1.2.5",
"clean-webpack-plugin": "^0.1.18",
"copy-globs-webpack-plugin": "^0.2.0",
"css-loader": "^0.28.9",
"cssnano": "~4.0.5",
"eslint": "~4.19.1",
"eslint-loader": "~1.9",
"eslint-plugin-import": "~2.14.0",
"extract-text-webpack-plugin": "~3.0.2",
"file-loader": "^1.1.6",
"friendly-errors-webpack-plugin": "^1.6.1",
"imagemin-mozjpeg": "~7.0.0",
"imagemin-webpack-plugin": "~2.2.0",
"import-glob": "~1.5",
"node-sass": "~4.9.4",
"postcss-loader": "~2.1.0",
"postcss-safe-parser": "~3.0",
"resolve-url-loader": "~2.3.1",
"rimraf": "~2.6",
"sass-loader": "~6.0",
"style-loader": "^0.22.1",
"stylelint": "^8.4.0",
"stylelint-config-standard": "~18.2.0",
"stylelint-webpack-plugin": "^0.10.5",
"uglifyjs-webpack-plugin": "^1.3.0",
"url-loader": "^0.6.2",
"webpack": "~3.10.0",
"webpack-assets-manifest": "^1.0.0",
"webpack-dev-middleware": "~2.0.4",
"webpack-hot-middleware": "~2.22.3",
"webpack-merge": "~4.1.4",
"yargs": "~11.0.0"
},
"dependencies": {
"jquery": "^3.3.1",
"slick-carousel": "^1.8.1",
"popper.js": "^1.14.7"
}
我哪里做错了?
7条答案
按热度按时间6yt4nkrj1#
我使用的OSX最新版本(10.14.4(18 E226))和节点12.
在使用node-sass 4.11时,我在尝试
npm install
、npm rebuild
(link)时出现了g++错误(../src/create_string.cpp:17:25: error: no matching constructor for initialization of 'v8::String::Utf8Value'
),但没有成功。我通过将node-sass更新到4.12(
npm install node-sass
)解决了这个问题,因为node-sass上的github issue表示4.12版本中实现了对节点12的支持。js4nwp542#
这对我来说是有效的。将您的节点版本降级到10.16.0节点12仍然有一些问题
ghg1uchk3#
将node-sass升级到4.12.0,它将修复此问题。
g6ll5ycj4#
节点12在运行
npm install node-sass
时有此问题,将节点降级到10.16可以工作ou6hu8tu5#
对我来说,这个解决方案很有效,步骤如下:
1.转到节点sass文件夹(它可以是..“/节点模块/节点sass/src”或其他位置,例如,对于Angular,它位于..“/节点模块/@angular-devkit/build-angular/节点模块/节点sass/src”),您可以在日志中找到位置:
1.打开创建字符串cpp
1.将
v8::String::Utf8Value string(value);
更改为v8::String::Utf8Value string(v8::Isolate::GetCurrent(), value);
如果你找不到“node-sass”文件夹,重新运行“npm install”,当你在控制台中看到node-sass日志时,用ctrl+c终止进程。
de90aj5v6#
如果有人正在使用Amazon EC2 AMI Image,请按照以下说明操作
1.仅从https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-up-node-on-ec2-instance.html安装nvm
根据AMI映像,node-sass构建将成功。
798qvoo87#
Github上还有一个关于
npm-sass
-node
兼容性的好答案。(MacOS相关问题)https://github.com/sass/node-sass/issues/2549#issuecomment-851609577