【问题标题】:gulp task issue with nodejs v10.3.0 : src\node_contextify.cc:629: Assertion `args[1]->IsString()' failednodejs v10.3.0 的 gulp 任务问题:src\node_contextify.cc:629: Assertion `args[1]->IsString()' failed
【发布时间】:2018-11-10 06:04:00
【问题描述】:

我最近将我的 nodejs 版本更新为 10.30.0。一切正常。但是我的 gulp 构建任务不起作用,在旧版本(9.X)上运行良好。这就是我得到的。

 gulp[11376]: src\node_contextify.cc:629: Assertion `args[1]->IsString()' failed.
 1: node::DecodeWrite
 2: node::DecodeWrite
 3: uv_loop_fork
 4: v8::internal::interpreter::BytecodeDecoder::Decode
 5: v8::internal::RegExpImpl::Exec
 6: v8::internal::RegExpImpl::Exec
 7: v8::internal::RegExpImpl::Exec
 8: 00000384E1284281

有人,请帮帮我。

【问题讨论】:

  • 升级后是否重新安装了模块?
  • 重新安装 gulp 相关包
  • 尝试重新安装所有节点模块。还是一样

标签: javascript node.js gulp node-modules


【解决方案1】:

npm(非纱线)解决方案

  1. 更新你的 npm 包
  2. npm rebuild // 安装也可能有效?
  3. 您可能会收到有关“并行”的新错误
  4. 按照本指南(不是我的):https://timonweb.com/javascript/how-to-fix-referenceerror-primordials-is-not-defined-error/

为什么? Gulp v3 + Node v12 互不兼容。不要尝试更新到 Gulp v4 来解决这个问题,因为有重大更改(除非你想重写你的代码)。不要降级 Node,因为它不可扩展,您可能会遇到其他问题。你将不得不升级最终

【讨论】:

    【解决方案2】:

    只需运行这两个命令。

    1. 删除node_modules文件夹

    rm -r 节点模块

    1. 并且只安装本地依赖项。

    npm 安装本机

    【讨论】:

      【解决方案3】:

      我的系统:

      1. Windows 10
      2. 节点 10.15.3

      步骤:

      1. npm 更新
      2. npm 我本地人
      3. npm 我
      4. npm 审计修复

      订单是必需的。

      我通过命令“npm update”更新后的包:

      {
        "name": "your name",
        "version": "0.1.0",
        "private": true,
        "dependencies": {
          "autoprefixer": "^7.2.6",
          "babel-core": "^6.26.3",
          "babel-loader": "^7.1.5",
          "babel-plugin-async-to-promises": "^1.0.5",
          "babel-preset-es2015": "^6.24.1",
          "bootstrap": "v4.0.0-beta",
          "chartist-webpack": "^0.9.5-0",
          "d3": "^4.13.0",
          "d3.js": "^0.0.2-security",
          "datalist-polyfill": "^1.23.3",
          "dimple-js": "^2.1.4",
          "future-tabs": "^1.3.2",
          "gridstack": "0.2.6",
          "gulp": "^3.9.1",
          "gulp-cache-bust": "^1.4.0",
          "gulp-clean": "^0.3.2",
          "gulp-connect": "^5.7.0",
          "gulp-cssmin": "^0.2.0",
          "gulp-extname": "^0.2.2",
          "gulp-postcss": "^7.0.1",
          "gulp-rename": "^1.4.0",
          "gulp-sass": "^3.1.0",
          "gulp-sequence": "^0.4.6",
          "gulp-sourcemaps": "^2.6.5",
          "ionicons": "^3.0.0",
          "jquery": "^3.3.1",
          "jquery-ui": "^1.12.1",
          "jquery-ui-touch-punch": "^0.2.3",
          "lodash": "^4.17.11",
          "md5": "^2.2.1",
          "moment": "^2.24.0",
          "natives": "^1.1.6",
          "postcss-flexbugs-fixes": "^2.0.0",
          "promise-polyfill": "6.0.2",
          "semaphore-async-await": "^1.5.1",
          "url-search-params-polyfill": "^2.0.3",
          "vanilla-modal": "^1.6.5",
          "webpack": "^3.12.0",
          "webpack-stream": "^4.0.3",
          "whatwg-fetch": "^2.0.4"
        }
      }
      

      【讨论】:

        【解决方案4】:

        使用节点 v10.16.0

        npm install natives

        npm audit fix

        【讨论】:

          【解决方案5】:

          gulp 我也遇到了类似的问题

          gulp build[30580]: c:\ws\src\node_contextify.cc:635: Assertion `args[1]->IsString()' failed. 1: 00007FF6F86BC6AA v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4506

          npm install natives解决了windows 64中的问题

          【讨论】:

            【解决方案6】:

            npm install natives

            这适用于 Windows 10 64 位

            【讨论】:

              【解决方案7】:

              我有两个不同的解决方案在两个不同的工作区工作。更新到节点 10.6.0 后的第一个要求我使用this method

              $rm -rf node_modules
              $rm -rf package-lock.json
              $npm cache clean
              $npm install
              

              第二个工作区不适用于上述情况,尽管我确实先尝试过,但它要求我重新安装所有 gulp 依赖项,然后运行 ​​npm audit fix。例如:

              $npm install --dev gulp gulp-sass gulp-autoprefixer
              $npm audit fix
              

              希望这对某人有所帮助。

              【讨论】:

              • 对于更高版本的节点,您必须使用 $npm cache clean --force 来删除缓存,或者在 Windows 上,删除 C:\user\AppData\Roaming\npm-cache 文件夹。这解决了我的问题
              • npm install natives 没有立即解决我的问题,但感谢@dwilli 手动删除文件夹并遵循此解决方案的建议对我有用
              【解决方案8】:

              node版本兼容问题,尝试使用node版本

              【讨论】:

              • 这才是真正有效的。从 >= 10.1 切换到 9.4.0。 “npm install natives”没有这样做。
              【解决方案9】:

              只需运行命令

              npm install natives
              

              【讨论】:

              • 我认为他们在 10.7.0 上解决了这个问题,现在可以正常工作了
              • + npm install + npm audit fix 需要让 gulp 再次工作。
              • 您可能需要再添加一个npm cache clean --force,然后是npm install,然后是npm install natives。这就是我的情况。
              • 请记住,这远非理想的解决方案。在 NPM 页面上阅读有关使用此包的警告:npmjs.com/package/natives 真正的解决方案可能是升级到当前版本的 Node 和 node-sass。
              • 它对我有用....非常感谢。浪费了 2 多个小时,最后,一个命令就解决了一个问题。
              【解决方案10】:

              我有同样的问题。删除 node_modules 并重新运行 npm install,以重新安装 package.json 中列出的模块,对我有用。

              【讨论】:

              • 不幸的是,它对我不起作用。我切换回旧版本运行构建
              • 我认为他们在 10.7.0 上修复了这个问题,现在可以使用了`
              猜你喜欢
              • 2014-08-15
              • 1970-01-01
              • 1970-01-01
              • 2015-10-08
              • 1970-01-01
              • 2023-04-03
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              相关资源
              最近更新 更多