johnpapa / gulp-patterns

Playground for Gulp Recipes
500 stars 146 forks source link

Error: Cannot find module 'utf8' #81

Closed michaelbowlin closed 9 years ago

michaelbowlin commented 9 years ago

Following instructions on the ReadMe doc for the installation process and came up with the error below. The weird thing is that I did the same process yesterday with no problems. Trying it again to see if it happens will keep the issue updated.

Error: Cannot find module 'utf8' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object. (......../gulp-patterns/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/index.js:5:12) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17)

johnpapa commented 9 years ago

i dont see that here.

michaelbowlin commented 9 years ago

I have tried the same process in my home office and was not able to replicate the issue. I will try it again at work and see if I encounter it. I assume that it is a problem on my work network?

I will keep this issue updated with my status. Thank you

johnpapa commented 9 years ago

ok, thanks

iljapanic commented 9 years ago

I'm getting the exactly same error:

Error: Cannot find module 'utf8'
    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> (.../node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/index.js:5:12)
    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)

Did you do anything specific to solve the issue @michaelbowlin? Or did it just magically go away?

michaelbowlin commented 9 years ago

I got this particular issue while at work were there are some of restrictions on downloads. Never figured out what caused this specific issue but repeating the process on my home network worked successfully.

iljapanic commented 9 years ago

I'm currently trying to run it at a school network. It worked yesterday at home, so it may be a very similar kind of issues you had.

michaelbowlin commented 9 years ago

Yea I've found the npm install and the bower install process to be inconsistent even in ideal settings. I cloned this repo for a friend the other day, followed the steps and came up with a bunch of errors from node. I then threw everything out and started over and it did magically work... weird?

Absolutely love this repo though! Using John Papa's patterns on a couple projects. This tut: http://www.pluralsight.com/courses/javascript-build-automation-gulpjs also uses a similar repo and he dives into the entire Gulp process.

igorlino commented 9 years ago

If it helps anyone, I faced some random errors at work with other colleague's computer. We are behind a proxy. The errors came from places you will never expect to happen. Digging into the issues, it happened some node modules dependencies under some node modules were for some reason incomplete (downloaded). I cannot say why exactly, but it was a fact. Fast fix here: remove the 'node_modules' directory and re-run "npm install".

Another point is that theoretically as long as the 3rd party versions are not fixed in npm and bower, any small variation may introduce side-effect. Usually it does not happen, but it cannot be 100% be discarded. There are some projects that release something every week.

I also became aware of another interesting fact while setting up a continuous integration build infrastructure. Basically, there are some build/deployments where we don't mind reusing the bower/npm repositories cached locally, but in case of final production version we build from scratch everything. This accentuates any no-version-fixed nature of "bower.json" and "package.json", typical for nearly every modern web project.

Also, but not 100% sure, I migrated to the very latest nodejs which includes a newer npm package. (older nodejs versions had a pretty old npm version) The problem was that this build from-scratch was failing from time to time. End of the story: https://github.com/johnpapa/gulp-patterns/issues/90 After fixing that, the build works flawlessly.