scotch / angular-brunch-seed

AngularJS + Brunch
Other
228 stars 78 forks source link

Cannot find module [...] node_modules/brunch/lib/cli and others #78

Closed gatlin closed 10 years ago

gatlin commented 10 years ago

I installed the most recent version of brunch:

$> npm install -g brunch

And then I cloned this repo:

$> cd Projects/carto_critic && git clone https://github.com/scotch/angular-brunch-seed ui && cd ui

I made sure to checkout the 0.4.0 commit (though I got the same issues in HEAD):

$> git reset --hard 4cffcba08874a5b101fb0ffd9b85f63576804ff6

I made sure to initialize everything:

$> ./scripts/init.sh

And bower:

$> ./node_modules/.bin/bower install

And finally, I tried to run the development server:

$> ./scripts/server.sh

The following is output:

module.js:340    
         throw err;          
                     ^
Error: Cannot find module '/Users/gatlinjohnson
/Projects/carto_critic/ui/node_modules/brunch/lib/cli'    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.<anonymous> 
(/Users/gatlinjohnson/Projects/carto_critic/ui/node_modules/brunch
/bin/brunch:7:1)    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 
Function.Module.runMain (module.js:497:10)

If I run my global brunch install:

$> brunch watch --server

I get an issue telling me font-awesome isn't installed and thus app.less won't install. font-awesome isn't in bower.json. So I install it and then run brunch again and things appear to work, except the example application has an error in Firefox in the console:

[18:30:26.704] SyntaxError: syntax error @ http://localhost:3333/js/vendor.js:1
[18:30:26.705] ReferenceError: angular is not defined @ http://localhost:3333/js/partials.js:1
[18:30:26.705] SyntaxError: missing ] after element list @ http://localhost:3333/js/app.js:1

I use angular-brunch-seed for other projects so I'm vexed as to how this happened.

es128 commented 10 years ago

try npm install -g https://github.com/brunch/brunch/tarball/master

kylefinley commented 10 years ago

@es128,

I'm seeing the same error with npm install -g https://github.com/brunch/brunch/tarball/master.

I believe this is regression, it was working yesterday. I'm trying to track down the issue now.

kylefinley commented 10 years ago

@gatlin,

This should be fixed now with ce3e272335628ffb98c5196bf6935193063326d9

Could you please confirm with ./script/init.sh or npm install -g https://github.com/brunch/brunch/tarball/master

lecaros commented 10 years ago

@kylefinley I was experiencing same issue.

I can confirm that it's working with last commit from master.

thank you!

kylefinley commented 10 years ago

Excellent!

I'm going to go head and close this for now. Please reopen if you're still experiencing issues.

gatlin commented 10 years ago

Sorry I was MIA there! [Insert excuse here.]

So I pulled from master, ran ./scripts/init.sh (and also ran npm install -g https://github.com/brunch/brunch/tarball/master) and finally ./scripts/server.sh and I got this on the console:

esther:ng-maybe gatlinjohnson$ ./scripts/server.sh 29 Jul 10:28:03 - error: { [Error: Component must have "/Users/gatlinjohnson/Projects/ng-maybe/bower_components/console-polyfill/bower.json"] code: 'NO_BOWER_JSON' }
29 Jul 10:28:03 - info: application started on http://localhost:3333/
29 Jul 10:28:04 - error: Compiling of 'app/styles/app.less' failed. '/bower_components/bootstrap-less/less/reset.less' wasn't found.
; Compiling of 'app/bower_components/bootstrap-less/less/accordion.less' failed. NameError:variable @baseLineHeight is undefined in 'app/bower_components/bootstrap-less/less/accordion.less:8:17'
[... for a while ...]

The full output is here. Additionally, the commit that you referenced does not exist anymore. Perhaps it was squashed (or similar)?

Sorry to be a stick in the mud! Maybe the problem is me, I can't quite tell :)

kylefinley commented 10 years ago

I can't reproduce this.

Maybe the bower_components directory as some bad files in it. Try removing it:

rm -rf bower_components

Then reinstalling

./script/init.sh

Or to save time just:

 ./node_modules/.bin/bower install

Or maybe it's a bower cache issue.

Try;

npm install -g bower
bower cache clean

Also try creating a fresh clone of the repo, maybe there are some non tracked files that are causing problems.

Please let me know if any of that helps.

gatlin commented 10 years ago

I tried a fresh pull from master just now and got the same problem. I didn't have a bower_components directory. Removing vendor and running ./scripts/init.shdoesn't do anything, nor the cache clean. The error output has to do with less. Here is a paste of it in its entirety. I updated less, no dice.

es128 commented 10 years ago

@gatlin See if you have a .bowerrc file anywhere in the project directory or its parent directories.

@kylefinley If this turns out to be the issue again, you may consider adding one to your repo to force the target directory to be reset to the default.

kylefinley commented 10 years ago

@gatlin I just pushed a commit that adds the .bowerrc file as @es128 suggested. Hopefully that will help.

One thing to note -- when I was testing this just now -- I had to run ./scripts/init.sh three times before it eventually worked. I don't know if this is due to my internet connection or general bugginess of node, but that might be what's causing your issue as well.

es128 commented 10 years ago

@kylefinley It was probably because the NPM registry has been struggling for the last couple days.

http://stats.pingdom.com/d50hxzpzk7x4/650599

es128 commented 10 years ago

https://github.com/paulmillr/read-components/issues/4

kylefinley commented 10 years ago

@gatlin, if you're still having issues I think that https://github.com/scotch/angular-brunch-seed/pull/85 by @kunjee17 might help with your issue. When you have time will you please test it.

Thanks, I really appreciate your patience