我正在Mac OS X上运行。我按照以下可接受的回答步骤Upgrade Node.js to the latest version on Mac OS,将node和npm更新为最新版本。节点:v10.4.1
和npm:6.1.0
现在,当我运行Gulp文件时,出现此错误:
gulp[2838]: ../src/node_contextify.cc:629:static void node::contextify::ContextifyScript::New(const FunctionCallbackInfo<v8::Value> &): Assertion `args[1]->IsString()' failed.
1: node::Abort() [/usr/local/bin/node]
2: node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, char const*, int, v8::Local<v8::Value>*, node::async_context) [/usr/local/bin/node]
3: node::contextify::ContextifyScript::New(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
4: v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo*) [/usr/local/bin/node]
5: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<true>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
6: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node]
7: 0x211117841bd
8: 0x2111178ee5d
9: 0x2111180b2a0
10: 0x21111793429
11: 0x21111793429
12: 0x21111793429
Abort trap: 6
有人知道这是什么问题吗?
答案 0 :(得分:4)
关于此的完整文章: https://davidsekar.com/nodejs/upgrading-your-gulp-for-running-with-node-v10
gulp 3.x不适用于节点10.x
去除口水
npm rm -g gulp
install gulp-cli(引入了gulp-cli软件包,请在此处https://www.npmjs.com/package/gulp-cli进行检查)
npm i gulp-cli -g
在项目中本地安装gulp v4
npm i gulp@next --save-dev
最后您需要更改gulpfile.js ,语法和功能已更改。因此,请阅读相关文章,它简单而直接。 Here it is again。
答案 1 :(得分:1)
我要做的就是也更新我的Gulp版本。运行npm rebuild node-sass
解决了我的问题
答案 2 :(得分:0)
不知道为什么,但是运行npm i natives
为我解决了这个问题。