Npm-check-updates: NODE 8.0.0 and NPM 4.2.0 ERROR express-load require.extensions.hasOwnProperty is not a function

Created on 1 Jun 2017  Â·  13Comments  Â·  Source: raineorshine/npm-check-updates

I am creating an app in Node 8.0.0 and NPM 5.0.0 and when i using express-load var load = require("express-load"); my server returns:

load/lib/express-load.js:32

  if (require.extensions.hasOwnProperty(ext) && extlist.indexOf(ext) === -1) {
                         ^

TypeError: require.extensions.hasOwnProperty is not a function
    at Object.<anonymous> (/Users/node_modules/express-load/lib/express-load.js:32:26)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/node_modules/express-load/index.js:8:18)
    at Module._compile (module.js:569:30)

I tried downgrade to npm sudo npm install -g [email protected] version 4.2.0 (https://github.com/tjunnone/npm-check-updates/issues/355) and does not works

Most helpful comment

this can be closed as https://github.com/tjunnone/npm-check-updates/issues/355 has been resolved

you may need to run npm uninstall npm-check-updates -g && npm install npm-check-updates -g though

All 13 comments

355 ?

The same

this can be closed as https://github.com/tjunnone/npm-check-updates/issues/355 has been resolved

you may need to run npm uninstall npm-check-updates -g && npm install npm-check-updates -g though

It's been fixed.

npm i -g npm-check-updates

See also #355

@mvgmenezes As mentioned in https://github.com/tjunnone/npm-check-updates/issues/355#issuecomment-305239234 and other comments above, you can uninstall and reinstall ncu to make that error go away. Closing since there is nothing ncu can do to fix this. Let me know if that doesn't work for you and I'll help you get it fixed!

Thanks you all guys!!!

But with me doesn't works, I alter the file package.json(npm-check-updates ) to "require-dir": "^0.3.2", and I checked my version required-dir is it.

I re-install rpm to 4.2.0, I run npm i -g npm-check-updates and I run ncu -u

I run npm uninstall npm-check-updates -g && npm install npm-check-updates -g

When I alter express-load.js line 32 its works

if (require.extensions.hasOwnProperty(ext) && extlist.indexOf(ext) === -1) {

to

if (Object.prototype.hasOwnProperty.call(require.extensions, ext)){

:)

in npm 5, require-dir 0.3.2 will work, i dont know older versions. that patch in ncu now, merged.

This is the same error as #355 but notice it is occurring in a completely different package: express-load. This is not an issue with npm-check-updates or any of its dependencies.

Upgrade express-load to 1.1.16 and it should work!

After

npm uninstall npm-check-updates -g && npm install npm-check-updates -g

I still getting TypeError: require.extensions.hasOwnProperty is not a function at requireDir

$ node -v
v8.1.2
$ npm -v
5.0.3

OK so I've installed stable node and now It works

sudo n stable
node -v
v8.0.0
npm -v
5.0.0

I Have the same problem
untitled

getting similar error now

```
mentorcv git:(development) ✗ ncu
/usr/local/lib/node_modules/npm-check-updates/node_modules/require-dir/index.js:97
if (!require.extensions.hasOwnProperty(ext)) {
^

TypeError: require.extensions.hasOwnProperty is not a function
at requireDir (/usr/local/lib/node_modules/npm-check-updates/node_modules/require-dir/index.js:97:37)
at Object. (/usr/local/lib/node_modules/npm-check-updates/lib/versionmanager.js:8:23)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (/usr/local/lib/node_modules/npm-check-updates/lib/npm-check-updates.js:16:10)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (/usr/local/lib/node_modules/npm-check-updates/bin/ncu:5:11)
➜ mentorcv git:(development) ✗```

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Simek picture Simek  Â·  5Comments

JoshuaKGoldberg picture JoshuaKGoldberg  Â·  3Comments

vayurobins picture vayurobins  Â·  5Comments

mkungla picture mkungla  Â·  6Comments

ibc picture ibc  Â·  7Comments