These are chat archives for codefellows/sea-c16-javascript

30th
Jul 2014
Scott Romney Burbidge
@sburbidg
Jul 30 2014 19:05

When I use

var fs = require('fs')

I get an error stating that require is not defined. I can still get the data from the server but it doesn't seem to let me access that data.

Ivan Storck
@ivanoats
Jul 30 2014 19:08
require is not defined in the browser unless you’re using require.js
it is part of node
also browserify
fs - sounds like that’s code designed for node
fs = filesystem
Scott Romney Burbidge
@sburbidg
Jul 30 2014 19:09
do I have to add anything beside node_modules for it to have access to fs?
Ivan Storck
@ivanoats
Jul 30 2014 19:10
why would use use fs in the browser? browser doesn’t normally have access to file system
for security
Scott Romney Burbidge
@sburbidg
Jul 30 2014 19:11
I was using it in my code. But I think I misunderstood something
Ivan Storck
@ivanoats
Jul 30 2014 19:11
which code?
Scott Romney Burbidge
@sburbidg
Jul 30 2014 19:12
The .js file for the Ajax assignment
Ivan Storck
@ivanoats
Jul 30 2014 19:12
fs is a module that’s built-in to node. so as long as you’re running the js via the node command, you should be able to require it
link?
Ivan Storck
@ivanoats
Jul 30 2014 19:13
where exactly - I don’t see require
Ivan Storck
@ivanoats
Jul 30 2014 19:15
getContent.js - defintiely meant to run on the server, via node
gotta pop out maybe @hankyates or @hlpetway can clarify?
Scott Romney Burbidge
@sburbidg
Jul 30 2014 19:19
I'll do some more reading on it and see what I can find out. Is there a way to see if node is still working because I'm worried I may have messed it up doing something in terminal
Joe Elsey
@joeelsey
Jul 30 2014 19:37
Question about the closure homework. I got it to count the function, but I lost the function itself. Doesn't return any sums. Just returning the count. Does the homework require both returns? Is there a way I could pass any function into the count function and return what I need? I'm sure there is I'm just not seeing it right now.
Ivan Storck
@ivanoats
Jul 30 2014 20:24
@sburbidg node -v if it prints out the version #, it should work
Hank Yates
@hankyates
Jul 30 2014 21:01
@sburbidg yeah it needs to run within a node context
so node filename.js
require wont work in the browser or jsfiddle unless you load require.js or a commonjs loader