Gulp: Error: Cannot find module 'internal/util/types'

Created on 20 Apr 2018  Â·  12Comments  Â·  Source: gulpjs/gulp

I've tried several different solutions online to fix this problem. Mostly reinstalling node and npm.
I also tried installing the latest graceful-fs with npm install -g graceful-fs graceful-fs@latest.

Some solutions say to sit tight unless it's causing a problem. In my case, it's causing problems.

I'm getting the following error.

Error: Cannot find module 'internal/util/types'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15)
    at Function.Module._load (internal/modules/cjs/loader.js:475:25)
    at Module.require (internal/modules/cjs/loader.js:598:17)
    at require (internal/modules/cjs/helpers.js:11:18)
    at evalmachine.<anonymous>:31:26
    at Object.<anonymous> (C:\tfs\MRCS\MRCS-DEV-image_viewer\MRCS.Web\node_modules\gulp\node_modules\vinyl-fs\node_modules\graceful-fs\fs.js:11:1)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)

This error happens with any gulp command from the gulp file.

Versions:
gulp: 3.9.1
npm: 5.6.0
node: 9.11.1 (although, I used 8.11.1 as well)

If I go to node version 6.2.2 then that fixed the problem. But, most people said that they download 6.2.2 and then redownload the latest and everything works fine. In my case, if I upgrade to 8.11.1 again, then stuff breaks.

Note: I also ran npm cache verify and npm install after the upgrade.

What should I do?

Most helpful comment

My solution is to update vinyl-fs。

All 12 comments

  1. You can't just switch versions and expect stuff with native deps to "just work" - you have to recompile everything.
  2. If a node version breaks graceful-fs, bring it up with them because they keep threatening to break userland.

To further elaborate - run npm rebuild to rebuild your native dependencies when you update your version of node.

I'm pretty sure I did recompile everything.
I said I ran npm cache verify and npm install but really I probably deleted my node_modules folder and ran npm cache clear --force.

However, I don't really know what I'm supposed to do. It sounds like npm rebuild is the answer.

Anywho, thanks for the comments.

I have the same problem on macOS. npm rebuild did not help.

Reinstalling node and clearing npm cache fixed it for me on windows 10

@christo8989 How to fix it eventually?

Update your dependencies, so you can use graceful-fs >=4. npm ls helps to find bad dependencies, for us it were old versions of gulp and gulp-typescript.

My solution is to update vinyl-fs。

C:xampphtdocsDICAdica-upload-ok-calendario-ko>npm run dev

[email protected] dev C:xampphtdocsDICAdica-upload-ok-calendario-ko
npm run development

internal/modules/cjs/loader.js:638
throw err;
^

Error: Cannot find module 'internal/util/types'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at evalmachine.:44:31
at Object. (C:xampphtdocsDICAdica-upload-ok-calendario-konode_modulesnpmnode_modulesgraceful-fsfs.js:11:8)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: npm run development
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersUtilizadorAppDataRoamingnpm-cache_logs2019-10-14T16_25_58_379Z-debug.log

C:xampphtdocsDICAdica-upload-ok-calendario-ko>yarn install
'yarn' is not recognized as an internal or external command,
operable program or batch file.

can someone help me?

Hi
I am new to node js world facing same issue even for npm cache clean and npm install or npm rebuild is throwing same error msg as below.

module.js:550
throw err;
^

Error: Cannot find module 'internal/util/types'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at evalmachine.:31:26
at Object. (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/fs.js:11:8)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)

can someone please help me on this ?

@vkkothawale I faced the same issue with node version 8.8.0 and was able to fix this by downgrading the node version to 6.10.2.

This worked for me:

cd node_modules/ionic/node_modules/ionic-app-lib/node_modules/vinyl-fs
npm uninstall graceful-fs
npm install [email protected]

Versions:

Cordova: 8.1.2
Gulp version: 3.9.1
Ionic: 1.7.16
Node: v10.22.1
Was this page helpful?
0 / 5 - 0 ratings

Related issues

lehni picture lehni  Â·  4Comments

emccorson picture emccorson  Â·  4Comments

ssteinerx picture ssteinerx  Â·  3Comments

XaBerr picture XaBerr  Â·  3Comments

joe-watkins picture joe-watkins  Â·  5Comments