davidedc / livecodelab

a web based livecoding environment
http://livecodelab.net/
MIT License
327 stars 63 forks source link

Build problems... 'Local Npm module "grunt-contrib-copy" (and others) not found.' #267

Closed xinaesthete closed 8 years ago

xinaesthete commented 8 years ago

So I thought I'd catch up with developments in LCL... nb, this should probably be more than one issue technically, but it seems easiest to explain this way...

Cloned latest master from the repository, install grunt / grunt-cli, then do npm install and try running grunt which leads to:

Peters-iMac:livecodelabOriginal Peter$ grunt
>> Local Npm module "grunt-contrib-copy" not found. Is it installed?
>> Local Npm module "grunt-recess" not found. Is it installed?
>> Local Npm module "grunt-targethtml" not found. Is it installed?
>> Local Npm module "grunt-contrib-coffee" not found. Is it installed?
>> Local Npm module "grunt-contrib-clean" not found. Is it installed?
>> Local Npm module "grunt-coffeelint" not found. Is it installed?
>> Local Npm module "grunt-contrib-watch" not found. Is it installed?
>> Local Npm module "grunt-contrib-requirejs" not found. Is it installed?
>> Local Npm module "grunt-docco" not found. Is it installed?
>> Local Npm module "grunt-contrib-connect" not found. Is it installed?
>> Local Npm module "grunt-contrib-nodeunit" not found. Is it installed?
>> Local Npm module "grunt-jison" not found. Is it installed?
Warning: Task "coffeelint" not found. Use --force to continue.`

I've tried a few different machines (OS X / Windows), all with similar results. At first I thought maybe it could be to do with being behind on node; now on v4.2.2 which I don't think made any tangible difference.

Anyway, I tried adding each of the missing modules manually with npm install --save-dev modulename... that gets me a little further:

Peters-iMac:livecodelabOriginal Peter$ grunt devbuild
Running "clean:build" (clean) task
>> 0 paths cleaned.

Running "copy:preBuild" (copy) task

Running "copy:tests" (copy) task
Created 5 directories, copied 46 files

Running "jison:main" (jison) task
Warning: Missing src property. Use --force to continue.

Aborted due to warnings.

So I edit Gruntfile.js and add a src/ so that line 207 becomes

            src: 'src/grammar/lcl-grammar.jison',

(this is correct for your master branch, I did also briefly checkout v2lang and see that it's different there).

That allows grunt devbuild to run without errors, but the page that is served by grunt connect is just some basic boilerplate thing that lets me click through some file hierarchy, but not much else... ho hum...

rumblesan commented 8 years ago

Hey @xinaesthete

apologies for the hassle, but the build system has changed, and I've been really bad at updating the docs :(

I changed over to using browserify, and having npm run the necessary build scripts because it massively simplified how things worked.

You should just be able to run

npm install
npm run devbuild
npm run serve

open up a browser, point it to http://localhost:8080 and then things should work. Have a look in package.json for all the individual build scripts.

I've been concentrating on the v2lang branch and got some of the changes merged into master, but I was lax on this front.

Hopefully that puts you on the right path. I'll update docs tomorrow

xinaesthete commented 8 years ago

Aha! Thanks for that.

While you're updating docs, you might add a sudo npm install -g browserify in there... although that still doesn't get me a working build, I'm afraid:

Peters-iMac:livecodelabOriginal Peter$ npm run devbuild

> livecodelab@0.1.0 devbuild /Users/Peter/Documents/code/www/livecodelabOriginal
> npm run buildfirst && npm run compiledev

> livecodelab@0.1.0 buildfirst /Users/Peter/Documents/code/www/livecodelabOriginal
> npm run statics && npm run style && npm run html && npm run jison

> livecodelab@0.1.0 statics /Users/Peter/Documents/code/www/livecodelabOriginal
> cp -r ./static/* ./dist/

> livecodelab@0.1.0 style /Users/Peter/Documents/code/www/livecodelabOriginal
> recess ./style/* --compile > ./dist/style.css

> livecodelab@0.1.0 html /Users/Peter/Documents/code/www/livecodelabOriginal
> cp ./html/index.html ./dist/

> livecodelab@0.1.0 jison /Users/Peter/Documents/code/www/livecodelabOriginal
> jison ./src/grammar/lcl-grammar.jison -m commonjs -o ./src/generated/parser.js

> livecodelab@0.1.0 compiledev /Users/Peter/Documents/code/www/livecodelabOriginal
> browserify --debug -t coffeeify --extension='.coffee' ./src/coffee/lcl-init.coffee -o ./dist/app.js

module.js:339
    throw err;
    ^

Error: Cannot find module 'through'
  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> (/Users/Peter/Documents/code/www/livecodelabOriginal/node_modules/coffeeify/index.js:2:15)
  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 Module.require (module.js:366:17)
  at require (module.js:385:17)
  at nr (/usr/local/lib/node_modules/browserify/node_modules/module-deps/index.js:282:21)
  at onfile (/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:51:21)
  at onex (/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:93:22)
  at /usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:24:18
  at FSReqWrap.oncomplete (fs.js:82:15)

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "compiledev"
npm ERR! node v4.2.2
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! livecodelab@0.1.0 compiledev: `browserify --debug -t coffeeify --extension='.coffee' ./src/coffee/lcl-init.coffee -o ./dist/app.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the livecodelab@0.1.0 compiledev script 'browserify --debug -t coffeeify --extension='.coffee' ./src/coffee/lcl-init.coffee -o ./dist/app.js'.
npm ERR! This is most likely a problem with the livecodelab package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     browserify --debug -t coffeeify --extension='.coffee' ./src/coffee/lcl-init.coffee -o ./dist/app.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls livecodelab
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Peter/Documents/code/www/livecodelabOriginal/npm-debug.log

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "devbuild"
npm ERR! node v4.2.2
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! livecodelab@0.1.0 devbuild: `npm run buildfirst && npm run compiledev`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the livecodelab@0.1.0 devbuild script 'npm run buildfirst && npm run compiledev'.
npm ERR! This is most likely a problem with the livecodelab package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run buildfirst && npm run compiledev
npm ERR! You can get their info via:
npm ERR!     npm owner ls livecodelab
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Peter/Documents/code/www/livecodelabOriginal/npm-debug.log
xinaesthete commented 8 years ago

Oh yeah, I should mention, I did also try this with v2langupdate and get much the same result.

rumblesan commented 8 years ago

hhmm, are you doing that npm run devbuild after a git clean to remove anything that may have been in your node_modules folder?

It shouldn't be necessary to install browserify globally as well. It gets pulled down by npm when running npm install. I'm making an assumption that you're on OSX/Nix btw. Windows is a bit of an unknown quantity, but should still be fine.

xinaesthete commented 8 years ago

I hadn't done git clean, worth a shot...

I added through and convert-source-map which at least let it npm run devbuild without errors. Doing a fresh npm install now.

xinaesthete commented 8 years ago

Yes, git clean did help. Got it running now. Will check Windows and let you know if I have any different experience there (I doubt it).

rumblesan commented 8 years ago

ah ha, glad to hear it's all working for you. I'll do a bit more cleanup on master around the build system and get the docs sorted.

Sometimes I forget that this is an open source project and there are actually other people looking at the code :)