56

I recently updated my nodejs version to 10.30.0. Everything works fine. But my gulp build task not working which was working fine on older version(9.X). This is what I am getting.

 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
E_net4
  • 27,810
  • 13
  • 101
  • 139
M14
  • 1,780
  • 2
  • 14
  • 31

11 Answers11

156

Just run command

npm install natives
Dmytro Rostopira
  • 10,588
  • 4
  • 64
  • 86
nosensus
  • 1,730
  • 1
  • 11
  • 10
  • I think they fixed this issue on 10.7.0 It is working now – M14 Jul 26 '18 at 05:15
  • This did it for me. I then ran `npm install` afterwards and all worked. I'm running node 10.9.0. – Ozzy Sep 19 '18 at 14:50
  • 7
    + `npm install` + `npm audit fix` was required to get gulp working again. – naaman Oct 14 '18 at 08:03
  • 4
    You may need to do an additional ```npm cache clean --force``` and then ```npm install``` and then ```npm install natives```. That was the combination in my case. – Veysel Ozdemir Dec 06 '18 at 16:07
  • 2
    Bear in mind that this is far from an ideal solution. Read the warning about the use of this package on it's NPM page: https://www.npmjs.com/package/natives The real solution to this is probably to upgrade to current versions of Node and node-sass. – Blieque Jan 15 '19 at 16:24
  • For me ( node -v => 10.15.1 ) works: `npm cache clean --force` then `npm install`, but without `npm install natives` ( installing natives throwing another error ) – user3057544 Feb 26 '19 at 11:50
  • I was receiving this error with a project using Visual Studio 2019 v16.1.0. Running npm install natives as per this answer solved the problem. Thanks. – tmutton May 23 '19 at 13:27
  • 2
    its worked for me .... thank you so much. wasted 2+ hours and finally, just single command solved an issue. – Jigar Aug 06 '19 at 09:25
  • This actually fixed my issue after spending entire day! – Khateeb321 Sep 06 '19 at 13:01
16

I have had two different solutions work in two different workspaces. The first after updating to node 10.6.0 required me to use this method:

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

The second workspace wouldn't work with the above, though I did try it first, it required me to reinstall all my gulp dependencies then run npm audit fix. For example:

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

Hope this helps someone.

jasonflaherty
  • 1,924
  • 7
  • 40
  • 82
  • 4
    with later versions of node you have to use $npm cache clean --force to delete the cache, or on Windows, delete the C:\user\AppData\Roaming\npm-cache folder. This fixed the issue for me – dwilli Feb 01 '19 at 21:08
  • 2
    `npm install natives` didn't immediately solve my problems, but thanks @dwilli manually deleting folders and following this solution's advice worked for me – Chris Schaller Jul 29 '19 at 23:26
5

node version compatible problem, try use node version<=9.11.2.

邱凯翔
  • 51
  • 1
  • 1
  • 1
    this is what actually works. switched to 9.4.0 from >= 10.1. "npm install natives" didn't do it. – arviman Dec 12 '18 at 09:50
2

I had the same issue. Deleting node_modules and re-running npm install, to re-install the modules listed in package.json, did work for me.

Constantine
  • 1,015
  • 1
  • 8
  • 12
1

Just run these two commands.

  1. remove node_modules folder

rm -r node_modules

  1. And Install only natives dependencies.

npm install natives

Gufran Hasan
  • 8,910
  • 7
  • 38
  • 51
1

The top-voted answer says to run npm install natives, but the natives package has been deprecated. One of the commentors says there's a warning at npmjs.com/package/natives. But I feel it's more than a warning. Quoting it:

This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs@4.x.

When the author of the package says: "Do not use it", you should probably heed their advice.

E_net4
  • 27,810
  • 13
  • 101
  • 139
smoffatt
  • 11
  • 1
0

npm install natives

This works with Windows 10 64 Bit

0

My system:

  1. Windows 10
  2. Node 10.15.3

Steps:

  1. npm update
  2. npm i natives
  3. npm i
  4. npm audit fix

The order is required.

My packages after when I have updated via command "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"
  }
}
Ikhlak S.
  • 8,578
  • 10
  • 57
  • 77
riwex
  • 88
  • 1
  • 7
0

I was facing similar problem too with 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 solved the problem in windows 64

kaleem
  • 59
  • 2
  • 8
0

using node v10.16.0

npm install natives

npm audit fix

TSmith
  • 543
  • 5
  • 16
lucho20pt
  • 77
  • 5
0

npm (not yarn) solution

  1. Update your npm packages
  2. npm rebuild // Install will likely work too?
  3. You'll likely get a new error about 'parallels'
  4. Follow this guide (not mine): https://timonweb.com/javascript/how-to-fix-referenceerror-primordials-is-not-defined-error/

Why? Gulp v3 + Node v12 are incompatible with each other. Don't try updating to Gulp v4 for the purpose of fixing this issue, as there are breaking changes (unless you wanna rewrite your code). Don't downgrade Node because it's not scalable and you may run into other issues. You'll have to upgrade eventually.

dylanh724
  • 948
  • 1
  • 12
  • 29