念念不忘
必有回响

升级node10后gulp报错的解决办法

升级完node后,发现hexo执行命令时会报错,但依旧能执行成功,先忽略,但是到了gulp命令的时候就提示如下错误:

gulp
gulp[9807]: ../src/node_contextify.cc:631:static void node::contextify::ContextifyScript::New(const FunctionCallbackInfo<v8::Value> &): Assertion `args[1]->IsString()' failed.
 1: node::Abort() [/usr/local/bin/node]
 2: node::Assert(char const* const (*) [4]) [/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: 0x39a33be0427d
[1]    9807 abort      gulp

不用想,肯定是node升级导致的,搜索一会儿获得解决方法:

rm -fr node_modules
rm -fr package-lock.json
npm cache clean --force
npm install

在hexo根目录(我的是~/blog)下执行上面的四个命令即可解决。当然hexo报错的问题也同时解决了。

参考链接:https://github.com/gulpjs/gulp/issues/2162

赞(0) 打赏
未经允许不得转载:码农志 » 升级node10后gulp报错的解决办法
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏