requireDir: Broken on node v8
There appears to be a change in require in node v8 that breaks require-dir:
C:\workspace\software-engineering\angular-mean>ncu
C:\Zimmermann\npm-config\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 (C:\Zimmermann\npm-config\node_modules\npm-check-updates\node_modules\require-dir\index.js:97:37)
at Object.<anonymous> (C:\Zimmermann\npm-config\node_modules\npm-check-updates\lib\versionmanager.js:8:23)
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> (C:\Zimmermann\npm-config\node_modules\npm-check-updates\lib\npm-check-updates.js:14:10)
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)
Reported at: https://github.com/tjunnone/npm-check-updates/issues/355
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 70
- Comments: 19 (5 by maintainers)
Commits related to this issue
- fix: use of hasOwnProperty in node version 8 Converted to clean objects here: https://github.com/mscdex/io.js/commit/3d8528d5060d9cc27d1b335925d51622c5e87ec6 resolves #45 — committed to scragg0x/requireDir by scragg0x 7 years ago
- Specify Node.js 7 for Travis CI The newly default node 8.0.0 is incompatible with the require-dir package: https://github.com/aseemk/requireDir/issues/45 — committed to WikiEducationFoundation/WikiEduDashboard by ragesoss 7 years ago
- Fix #45 hasOwnProperty bug with Node.js v8 — committed to krnlde/requireDir by krnlde 7 years ago
- fix(require-dir): broken on node 8 Proof: https://github.com/aseemk/requireDir/issues/45 — committed to Fyzu/csssr-project-template by Fyzu 7 years ago
- Update require-dir version update require-dir version to "^0.3.2" after module breaks in Node v8 (https://github.com/aseemk/requireDir/issues/45) — committed to ericconstantinides/gulp-webpack-starter by ericconstantinides 7 years ago
- fix(require-dir): broken on node 8 (#206) Proof: https://github.com/aseemk/requireDir/issues/45 — committed to CSSSR/csssr-project-template by Fyzu 7 years ago
- fix(dependency): Update Require Dir Updating Require Dir version to 0.3.2 to fix issue with Node 8. See here: https://github.com/aseemk/requireDir/issues/45 — committed to Teradata/covalent-code-editor-nightly by deleted user 7 years ago
- bump require version to fix travis build As suggested by https://github.com/aseemk/requireDir/issues/45 — committed to cfpb/complaint by chosak 7 years ago
- Support node v8 See https://github.com/aseemk/requireDir/issues/45 — committed to davidpodhola/web-self-service-app by davidpodhola 6 years ago
- bump require version to fix travis build As suggested by https://github.com/aseemk/requireDir/issues/45 — committed to cfpb/complaint by chosak 7 years ago
Okay, this is live on npm as 0.3.2.
Thank you again @scragg0x and others for reporting and fixing, and for your patience!
The offer to help maintain still stands for anyone interested.
I just sent a PR #48 for this issue
I would be interested in contributing/maintaining, we use this project heavily at my company.
Sorry folks, I’ve changed jobs and don’t have time to maintain this library right now. I’m happy to add people as contributors — please just respect semver and get some amount of consensus before making major changes. =)
Anyone interested in maintaining? cc @scragg0x and @krnlde — thank you both for the recent PRs!
@stevelacy: Done! Thank you in advance for your help. =)
I went ahead and merged @scragg0x’s PR #46. I still need to publish to npm; doing so soon.
I installed nvm (Node Version Manager) and downgraded node version from 8.8.1 to stable 6.11.0 and it resolved the issue.
nvm install 6.11.0
Btw, at my previous company (@FiftyThree), we stopped using this package (
requireDir) in the last year or so, because we moved to ES6 modules (import ..., via TypeScript in our case). ES6 modules don’t support dynamic import paths, so dynamically reading the contents of a directory was no longer possible.But! It looks like there’s a proposal to support dynamic
import:https://github.com/tc39/proposal-dynamic-import
And it looks like that’s being tracked or polyfilled by TypeScript, Babel, etc.:
https://github.com/Microsoft/TypeScript/issues/12364 https://github.com/airbnb/babel-plugin-dynamic-import-node
So maybe it’ll be time for an
importDirat some point. =)Mind my implementation with
Object.keys, which renders the use ofhasOwnPropertyobsolete. #49