nodejs / node

Node.js JavaScript runtime ✨🐢🚀✨
https://nodejs.org
Other
106.96k stars 29.2k forks source link

node asserts in node_contextify.cc:631 Assertion `args[1]->IsString()' failed #20325

Closed bentoi closed 5 years ago

bentoi commented 6 years ago

This issue has been solved: Please use a gulp version >= 4.0.0. Thank you.


Trying to build our sources using the latest node, node crashes with the assert below when running gulp.

Step to reproduce:

$ git clone --depth 1 -b 3.7 https://github.com/zeroc-ice/ice
$ cd ice/js
$ npm install
$ npm run build

The stack trace:

$ npm run build

> ice@3.7.1 build /Users/benoit/Devel/GitHub/ice37/js
> gulp

gulp[46138]: ../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: 0x36ecf288427d
apapirovski commented 6 years ago

See https://github.com/nodejs/node/issues/20281 for more info and https://github.com/nodejs/node/issues/20285

wustzhaohui commented 6 years ago

so what's the solution ?

collinoswaltpsd commented 6 years ago

@wustzhaohui my workaround was to downgrade in my particular case. 10.3.0 -> 8.11.2 (chose this version because it's what a coworker is using)

wustzhaohui commented 6 years ago

I solve this problem by download node of v8.11.3 .

siddharthagit commented 6 years ago

I am also getting the same error after upgrading node version on Mac.

i30 commented 6 years ago

Don't understand why but run npm i natives solved the problem for me.

tterb commented 6 years ago

@i30 That seems to have fixed the problem for me too, but I can't seem to figure out why either.

timdhoffmann commented 6 years ago

@i30 Thanks, i'm having a slightly different error output, but this helped me as well!

onokje commented 6 years ago

Same here, npm i natives fixed it

stevepiron commented 6 years ago

Same here

davidprae commented 6 years ago

npm i natives did not solve it for me.

ecker00 commented 6 years ago

After reading the npm natives readme, it didn't seem like a good idea to use that solution. This fixed it for me:

rm -r node_modules
npm install
cah-ranjithgampa commented 6 years ago

@ecker00's Solution worked for me as well.

worldbeater commented 6 years ago

Experiencing the same error, npm i natives did the trick. Don't understand why the issue is closed. The bug actually exists and is rather annoying.

a-r-m-i-n commented 6 years ago

I've also run in this error and the npm i natives fixed it! Deleting node_modules manually and reinstall everything, did not fix it!

Update: I've figured out that the given dependencies may occure this behaviour. Indeed, installing the package "natives" works, while reinstalling didn't work...

But when I cleanup the (messy) dependency list, my gulp tasks work like charm, also without installing "natives".

This was my required packages before the cleanup:

    "clean": "^4.0.2",
    "cssnano": "^4.0.0-rc.2",
    "del": "^3.0.0",
    "eslint": "^4.19.1",
    "eslint-config-standard": "^11.0.0",
    "eslint-plugin-import": "^2.11.0",
    "eslint-plugin-node": "^6.0.1",
    "eslint-plugin-promise": "^3.7.0",
    "eslint-plugin-standard": "^3.1.0",
    "gulp": "^3.9.1",
    "gulp-cli": "^2.0.1",
    "gulp-concat": "^2.6.1",
    "gulp-imagemin": "^4.1.0",
    "gulp-postcss": "^7.0.1",
    "gulp-rename": "^1.2.2",
    "gulp-sass": "^4.0.1",
    "gulp-sourcemaps": "^2.6.4",
    "gulp-uglify": "^3.0.0",
    "gulp-util": "^3.0.8",
    "gulp-watch": "^5.0.0",
    "postcss": "^6.0.22",
    "postcss-assets": "^5.0.0",
    "postcss-inline-svg": "^3.1.1",
    "postcss-preset-env": "^5.1.0",
    "postcss-pxtorem": "^4.0.1",
    "postcss-reporter": "^5.0.0",
    "postcss-scss": "^1.0.5",
    "postcss-syntax": "^0.28.0",
    "postcss-validator": "^0.2.0",
    "stylelint": "^9.2.0",
    "stylelint-config-recommended-scss": "^3.2.0",
    "stylelint-config-standard": "^18.2.0",
    "stylelint-scss": "^3.1.0"

And this after the cleanup:

    "clean": "^4.0.2",
    "cssnano": "^4.0.0-rc.2",
    "del": "^3.0.0",
    "gulp": "^3.9.1",
    "gulp-imagemin": "^4.1.0",
    "gulp-postcss": "^7.0.1",
    "gulp-rename": "^1.2.2",
    "gulp-sass": "^4.0.1",
    "gulp-sourcemaps": "^2.6.4",
    "postcss-assets": "^5.0.0",
    "postcss-inline-svg": "^3.1.1",
    "postcss-preset-env": "^5.1.0",
    "postcss-pxtorem": "^4.0.1",
    "postcss-reporter": "^5.0.0",
    "postcss-scss": "^1.0.5",
    "postcss-validator": "^0.2.0",
    "stylelint": "^9.2.0",
    "stylelint-config-recommended-scss": "^2.0.0",
    "stylelint-config-standard": "^17.0.0",
    "stylelint-scss": "^2.1.0"

Not sure which package was responsible for the issue... But I guess it's about wrong dependency versions which are fetched, because they were defined in packages.json.

sherpa-nimesh commented 6 years ago

@i30 Thanks Mate npm i natives solved the issue for me

download13 commented 6 years ago

Just had this issue on 10.8.0

$ NODE_ENV=dev node server.js
MINGW64:/c/Users/downl/code/work/app[21376]: src\node_contextify.cc:637: Assertion `args[1]->IsString()' failed.
 1: 00007FF7E3BE9055
 2: 00007FF7E3BC2FE6
 3: 00007FF7E3BC30B1
 4: 00007FF7E3B98B8A
 5: 00007FF7E41DB022
 6: 00007FF7E41DC1B8
 7: 00007FF7E41DB51D
 8: 00007FF7E41DB43B
 9: 000000A85D0841C1

npm i natives did not help in my case.

abominab commented 6 years ago

@download13 That looks almost identical to mine. Been trying to fix this for 2 days now, nothing I've found online has worked.

gulp build --env dev [15:31:44] Failed to load external module @babel/register [15:31:44] Requiring external module babel-register gulp[6048]: src\node_contextify.cc:637: Assertionargs[1]->IsString()' failed. 1: 00007FF69A0E9055 2: 00007FF69A0C2FE6 3: 00007FF69A0C30B1 4: 00007FF69A098B8A 5: 00007FF69A6DB022 6: 00007FF69A6DC1B8 7: 00007FF69A6DB51D 8: 00007FF69A6DB43B 9: 00000239F2B041C1 npm ERR! code ELIFECYCLE npm ERR! errno 134

ecker00 commented 6 years ago

I ran into this again with another project where reinstalling did not work. When I tried npm upgrade I got:

WARN babel-loader@7.1.5 requires a peer of webpack@2 || 3 || 4 but none is installed. You must install peer dependencies yourself.

My project does not use Webpack, but I had Babel as a dependency (gulp-babel). So maybe that's the culprit? I no longer had the need for gulp-babel, after I removed all Babel it from my packages.json then gulp worked again after a reinstall.

// Packages I removed to resolve the issue:
    "babel-core": "^6.26.3",
    "babel-loader": "^7.1.5",
    "babel-preset-es2015": "^6.24.1",
    "gulp-babel": "^7.0.0",
freesoft commented 6 years ago

npm I natives resolved my issues.

wenkangzhou commented 5 years ago

delete package-lock.json & npm i work for me.

webroru commented 5 years ago

delete package-lock.json & npm i work for me.

Thanks! Or npm-shrinkwrap.json. work for me too

Hank-Liquidus commented 5 years ago

Don't understand why but run npm i natives solved the problem for me.

Thanks! this worked for me!!

josephkandi commented 5 years ago

delete package-lock.json & npm i work for me.

This is what worked for me. I first did npm i natives and it solved the problem, but i felt i didnt need to install another package so the above worked perfectly.

bnoordhuis commented 5 years ago

@joyeecheung Why did you reopen? Anything actionable?

joyeecheung commented 5 years ago

@bnoordhuis Probably hit the wrong button...sorry. For posterity see https://github.com/nodejs/node/issues/20325#issuecomment-384534318

martinlevesque commented 5 years ago

delete package-lock.json & npm i work for me.

This fixed the issue for me

aagentah commented 5 years ago

Not sure why... but npm i natives just works.

fpk7660837 commented 5 years ago

npm i natives works,thanks

dcworldwide commented 5 years ago

delete package-lock.json & npm i

Fixed my issue. No need for npm i natives

Hank-Liquidus commented 5 years ago

delete package-lock.json & npm i

Fixed my issue. No need for npm i natives

dcworldwide, you are absolutely right, thank you!!

Amirpasha10 commented 5 years ago

This steps resolved this problem: Simply delete node_modules dir and package-lock.json. Then run npm install --unsafe-perm=true

jiteshkumawat commented 5 years ago

After reading the npm natives readme, it didn't seem like a good idea to use that solution. This fixed it for me:

rm -r node_modules
npm install

This is a better solution than installing natives

tmutton commented 5 years ago

delete package-lock.json & npm i

Fixed my issue. No need for npm i natives

This fixed my issue

Node: v4.2.3 NPM: 2.14.7

kerryj89 commented 5 years ago

npm i natives worked for me in the end. The safer looking npm i did not work, nor did rm -r node_modules; npm install in my case.

Jkettler commented 5 years ago

If you're running into this because you're trying to start gulp through supervisor, check to see if you have a different version of node installed at /usr/local/bin/node -v. This may be the version gulp is trying to use, despite whatever your nvm ls output says.

To insure you're running with a specific version, you can run it with a version argument to nvm run, e.g. nvm run 6.14.4 ./node_modules/gulp/bin/gulp.js dev.

This fixed the issue for me.

phil-veloso commented 5 years ago

Running npm i natives solved the problem for me.

PlanetGit commented 5 years ago

Solved the problem for me. rm -rf node_modules rm -rf package-lock.json npm i

spjpgrd commented 5 years ago

Came here because I'm working on getting a Microsoft Teams tab app up and running locally.

This did the trick to generate the manifest file:

cd ~/whateverYourProjectFolderIs
rm -rf node_modules
rm -rf package-lock.json
npm i natives
AkiyamaMinami commented 5 years ago

delete package-lock.json & npm i work for me.

cool~ solve it

seaBubble commented 5 years ago

Having this issue too

tamimsyed700 commented 5 years ago

Same here. npm i natives fixed the issue.

powelleric commented 5 years ago

Had this issue today but could not resolve it with natives. I think I was using v10.16. Anyway, had to downgrade to v8, as suggested by others. I was able to use the latest v8: 8.16. Downloaded from here

addaleax commented 5 years ago

Please don’t use old versions of gulp anymore. I’ve updated the issue description to reflect that this problem has been solved properly, namely through upgrading to gulp >= 4.0.0.

magervino commented 5 years ago

npm i natives worked for me as well. Dunno if it is the reason of the problem (quite sure it is), but i just installed react on my laptop. https://www.npmjs.com/package/react-native

voidnerd commented 5 years ago

Had same issue npm i natives fixed it

mohitsehgal commented 5 years ago

delete package-lock.json & npm i

cute-angelia commented 5 years ago

Don't understand why but run npm i natives solved the problem for me.

awesome

rezadaulay commented 5 years ago

delete package-lock.json & npm i

Fixed my issue. No need for npm i natives

solved my problem

SunaliBandara commented 5 years ago

i got the error as npm[6700]: c:\ws\src\node_contextify.cc:626: Assertion `args[1]->IsString()' failed. then i running

npm i natives

problem solved. note: i checked my node version and it was v10.15.3 . so i think the isssue may be with the node version.