question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gulp - Error: cannot find module 'immutable'

See original GitHub issue

The Problem

I’m currently using browser-sync as a gulp dev-dependency for an express.js app. Everything seems to work fine in a local version of this app but when I:

  • git clone the repo
  • npm install
  • npm start or nodemon ./bin/www
  • gulp

Running gulp will give me an error that looks related to browser-sync and immutable. Here’s a truncated error (full errors near the end of the issue):

throw err;
      ^
Error: Cannot find module 'immutable'
...
(truncated for length)
...

When I look at the output from install browser-sync by itself, I can see that immutable is installing successfully:

$ npm install browser-sync --save-dev
...
CXX(target)
Release/obj.target/bufferutil/src/bufferutil.o
browser-sync@2.2.2 node_modules/browser-sync
...
β”œβ”€β”€ immutable@3.6.3
...

Attempted Solutions

  • I’ve tried deleting my node_modules and re-installing all dependencies with npm install but the error still persists.
  • In package.json, tried removing ^ and ~ from dependencies to lock-in versions for npm modules
  • (Probably unnecessary but) Rebuilt the app from scratch to see if the error would still persist, and it does. Here’s the repo where I rebuilt it from scratch.

Full Console Output (errors, immutable-related)

Running npm install for browser-sync

$ npm install browser-sync --save-dev
npm WARN package.json brianhan-io-restart@1.0.0 No repository field.

> ws@0.5.0 install /Users/brianhan/Dev/sites/brianhan-io-restart/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/bufferutil.node
  SOLINK_MODULE(target) Release/bufferutil.node: Finished
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/validation.node
  SOLINK_MODULE(target) Release/validation.node: Finished

> ws@0.4.31 install /Users/brianhan/Dev/sites/brianhan-io-restart/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
browser-sync@2.2.2 node_modules/browser-sync
β”œβ”€β”€ async-each-series@0.1.1
β”œβ”€β”€ emitter-steward@0.0.1
β”œβ”€β”€ opn@1.0.1
β”œβ”€β”€ dev-ip@1.0.1
β”œβ”€β”€ immutable@3.6.3
β”œβ”€β”€ ua-parser-js@0.7.3
β”œβ”€β”€ browser-sync-client@1.0.2
β”œβ”€β”€ portscanner@1.0.0 (async@0.1.15)
β”œβ”€β”€ meow@3.1.0 (object-assign@2.0.0, minimist@1.1.0, camelcase-keys@1.0.0, indent-string@1.2.1)
β”œβ”€β”€ foxy@10.0.2 (cookie@0.1.2, meow@2.1.0, http-proxy@1.8.1)
β”œβ”€β”€ resp-modifier@2.0.1 (minimatch@2.0.1)
β”œβ”€β”€ easy-extender@2.2.0 (lodash@2.4.1)
β”œβ”€β”€ connect@3.3.4 (utils-merge@1.0.0, parseurl@1.3.0, debug@2.1.2, finalhandler@0.3.3)
β”œβ”€β”€ serve-index@1.6.2 (parseurl@1.3.0, batch@0.5.2, debug@2.1.2, http-errors@1.3.1, accepts@1.2.4, mime-types@2.0.9)
β”œβ”€β”€ serve-static@1.9.1 (utils-merge@1.0.0, escape-html@1.0.1, parseurl@1.3.0, send@0.12.1)
β”œβ”€β”€ glob-watcher@0.0.8 (gaze@0.5.1)
β”œβ”€β”€ eazy-logger@2.1.1 (tfunk@3.0.1, opt-merger@1.1.0)
β”œβ”€β”€ localtunnel@1.5.0 (debug@0.7.4, optimist@0.3.4, request@2.11.4)
β”œβ”€β”€ lodash@3.4.0
β”œβ”€β”€ socket.io@1.3.5 (debug@2.1.0, has-binary-data@0.1.3, socket.io-adapter@0.3.1, socket.io-parser@2.2.4, engine.io@1.5.1, socket.io-client@1.3.5)
└── browser-sync-ui@0.4.9 (connect-history-api-fallback@0.0.5, angular-touch@1.3.14, angular-sanitize@1.3.14, angular-route@1.3.14, angular@1.3.14, weinre@2.0.0-pre-I0Z7U9OV)

When running gulp

$ gulp
throw err;
      ^
Error: Cannot find module 'immutable'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/brianhan/Dev/sites/brianhan-io-restart/node_modules/browser-sync/lib/hooks.js:4:20)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)

My Repo

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
shakyShanecommented, Mar 8, 2015

npm rm browser-sync && npm install browser-sync

The problem was with the immutable lib, which is now fixed. On Sun, 8 Mar 2015 at 06:17, William Huang notifications@github.com wrote:

this same error is happening to me on this version, no problems in 2.2.1

β€” Reply to this email directly or view it on GitHub https://github.com/BrowserSync/browser-sync/issues/502#issuecomment-77735341 .

0reactions
sonvisalcommented, Dec 4, 2015

I have problem with run node js

Start at Fri Dec 04 2015 module.js:339 throw err; ^

Error: Cannot find module β€˜http-sync’ at Function.Module._resolveFilename (module.js:337:15) at Function.Module._load (module.js:287:25) at Module.require (module.js:366:17) at require (module.js:385:17) at Object.<anonymous> (/home/visal/Downloads/influenceurs/INFLUENCEURS/influenceur.js:4:14) at Module._compile (module.js:435:26) at Object.Module._extensions…js (module.js:442:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:311:12) at Function.Module.runMain (module.js:467:10)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Cannot find module 'immutable' on existing project ...
npm WARN gatsby-source-filesystem@1.5.39 requires a peer of gatsby@^1.9.250 but none is installed. You must install peer dependencies yourself.
Read more >
Immutable-ext Cannot find module - Stack Overflow
immutable-ext has immutable as a peer dependency. That means you have to install immutable by yourself.
Read more >
immutable - npm
Introduction. Immutable data cannot be changed once created, leading to much simpler application development, no defensive copying, and enablingΒ ...
Read more >
Migration | Yarn - Package Manager
Cannot find module [. ... Run npm install -g yarn to update the global yarn version to latest v1 ... There is no...
Read more >
Node.js v19.3.0 Documentation
Features are marked as legacy rather than being deprecated if their use does no harm, and they are widely relied upon within the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found