### NodeJs.NodeJs History

January 02, 2018, at 08:29 PM by MichaelPaulukonis -

As of Dec 2017 I’ve started using for Node development. I miss a lot of my Emacs customizations, but the other seamless integrations make up for it.

Changed lines 71-104 from:

### ultra REPL

https://github.com/Benvie/Node.js-Ultra-REPL

Installation instructions say to use an included .cmd file to launch, but I found it tried to launch PUTTY for no reason I could see (in the, say, 30 seconds I spent worrying about it).

However, the following worked:

1. launch windows shell
2. cd to \path\node_modules\ultra-repl\bin
3. node ultra-repl.js

UPDATE: (a few minutes later) As I wrote the above, I was slightly suspicious, as the upper-left of the launched nodejs instance looked like the putty logo.

It is.

I looked at the source code, and saw that it had an INVARIANT launch of putty if the environment was windows (which mine is).

I tried the .cmd file a second time, and it launched fine.
Not sure what happened the first time around.
I _should have_ grabbed a screencap.

http://cs.brown.edu/courses/csci1320/labs/node_lab.html
http://ofps.oreilly.com/titles/9781449398583/chap1_id35940135.html

http://www.nodebeginner.org/
http://stackoverflow.com/questions/2353818/how-do-i-get-started-with-node-js

markov chain module for node.js
https://github.com/exratione/state-engines
https://github.com/substack/node-markov

to:
Deleted lines 83-84:
Deleted lines 86-90:

## Shared rendering in node and browser

http://substack.net/shared_rendering_in_node_and_the_browser - that is, browserify

June 22, 2017, at 11:42 AM by MichaelPaulukonis - updation notes
Changed lines 20-21 from:

Can use Chocolatey: cinst nodejs.install to install node and npm, cup nodejs.install to upgrade

to:

Can use Chocolatey: cinst nodejs.install to install node and npm, cup nodejs.install -y to upgrade both Node and npm

Changed line 24 from:

Once node and npm are installed, running npm i -g npm will update npm.

to:

Once node and npm are installed, running npm i -g npm will update npm (or you can update Node and npm together; see aboe).

June 20, 2017, at 11:54 AM by MichaelPaulukonis -
Changed line 20 from:

Can use Chocolatey: cinst nodejs.install to install node and npm

to:

Can use Chocolatey: cinst nodejs.install to install node and npm, cup nodejs.install to upgrade

February 15, 2015, at 11:25 AM by MichaelPaulukonis - npm install error, and general install and update enhancement
Changed lines 21-27 from:

Chocolately’s nodejs is an alias for nodejs.commandline which simply installs Node.exe to the Chocolatey folder. Does not include NPM.

to:

Do NOT run cinst nodejs - Chocolately’s nodejs is an alias for nodejs.commandline which simply installs Node.exe to the Chocolatey folder. Does not include NPM.

Once node and npm are installed, running npm i -g npm will update npm.

### npm installation

If you’re getting a Error: No compatible version found: [foo@’^n.n.n’] you may need to update to the latest version of node and npm (see above).

December 07, 2013, at 04:14 PM by OtherMichael - extracting debugging to own page
Deleted lines 27-78:

## Debugging

http://blog.strongloop.com/announcing-a-new-and-improved-node-js-debugger/

### node-inspector

https://github.com/node-inspector/node-inspector

On Windows (7), npm-install requires being run as Administrator. This is not an issue of node-inspector so much as a sub-package (ws?) of socket-io.

I was able to run node-inspector on Windows7 without needing to know the PID via the following (after a successful install):

node --debug-brk <file.js> in one shell
node-inspector& in ANOTHER shell

then browsing to http://localhost:8080/debug?port=5858 in Chrome

One or both of my shells may have been run as administrator; do not know if this is required or not (it was for installation)

discovered via post and comment

#### attach to running node process on Windows

NOTE: as of 2013.09.19 this is not official, and there is some discussion about the wording.
As the discussion points out, process._debugProcess() is an undocumented (or internal?) API function and may be subject to change.

Windows does not support UNIX signals. To enable debugging, you can use an undocumented API function process._debugProcess(pid)

1. Get the PID of the node process using your favorite method, e.g.

tasklist /FI "IMAGENAME eq node.exe"

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
node.exe                      3084 Console                    1     11,964 K

2. Call the API:

node -e "process._debugProcess(3084)"

Great! Now you are ready to attach the inspector.

#### Node-inspector for jakefiles

https://github.com/mde/jake/issues/226

1. node --debug-brk "\path\to\node_modules\jake\bin\cli.js" <rest of jake parameters>
2. node-inspector &

November 26, 2013, at 04:28 PM by OtherMichael -
Changed lines 96-98 from:

to:
Changed lines 160-205 from:

I ran into the same problem as this question: npn install -g cannot find module

(:source lang=text:)
module.js:340
throw err;
^
Error: Cannot find module ‘colors’
at Function.Module._resolveFilename (module.js:338:15)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (d:\Dropbox\projects\\util\util.js:6:14)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Function.Module.runMain (module.js:497:10)
(:sourceend:)

And used the same solution:

For anyone else running into this, I had this problem due to my npm installing into a location that’s not on my NODE_PATH.

I did an echo  and saw it was undefined.
As a test, I did set NODE_PATH=c:\users\mpaulukonis\appData\Roaming\npm\node_modules\ in the current, and the file now worked.
I added the env-var to the main user environment variables.

Not so sure about that path, though. looks ugly and funky.
What if.... node modules are on DropBox? Is that a bad idea?
How to change this location?

## npm install global vs local

In general, the rule of thumb is:

1. If you’re installing something that you want to use in your program, using require(‘whatever’), then install it locally, at the root of your project.
2. If you’re installing something that you want to use in your shell, on the command line or something, install it globally, so that its binaries end up in your PATH environment variable.

(source)

to:
Changed line 173 from:
to:

November 21, 2013, at 11:42 AM by OtherMichael - update on chocolatey
Changed lines 20-21 from:

Can use Chocolatey: cinst nodejs

to:

Can use Chocolatey: cinst nodejs.install to install node and npm
Chocolately’s nodejs is an alias for nodejs.commandline which simply installs Node.exe to the Chocolatey folder. Does not include NPM.

November 21, 2013, at 11:36 AM by OtherMichael - chocolatey install
Changed lines 16-17 from:

to:

Can use Chocolatey: cinst nodejs

November 20, 2013, at 01:41 PM by OtherMichael -

## Shared rendering in node and browser

http://substack.net/shared_rendering_in_node_and_the_browser - that is, browserify

November 14, 2013, at 12:50 PM by OtherMichael -

http://substack.net/how_I_write_modules
http://substack.net/shared_rendering_in_node_and_the_browser

November 13, 2013, at 11:14 AM by OtherMichael - nodeschool.io "review"
Changed line 144 from:

nodeschool.io - provides (via npm) four command-line based “lesson plans”

to:

nodeschool.io - provides (via npm) four command-line based “lesson plans” (here’s a review)

November 13, 2013, at 11:13 AM by OtherMichael - nodeschoool.io
Changed lines 142-149 from:

Learn Node.js Completely and with Confidence 0 book recommendations and pace of study based on them

to:

Learn Node.js Completely and with Confidence - book recommendations and pace of study based on them

nodeschool.io - provides (via npm) four command-line based “lesson plans”

1. Learn You the Node.js For Much Win!
• Learn you the Node.Js workshop notes
3. Level Me Up Scotty
4. Functional Javascript

October 23, 2013, at 03:19 PM by OtherMichael - installation header, and upgrade note

(on windows, at least) Just run the latest installer.

September 19, 2013, at 01:22 PM by OtherMichael - node-inspector jake

#### Node-inspector for jakefiles

https://github.com/mde/jake/issues/226

1. node --debug-brk "\path\to\node_modules\jake\bin\cli.js" <rest of jake parameters>
2. node-inspector &

September 19, 2013, at 09:08 AM by OtherMichael -

(:title node.js:)

Changed lines 40-60 from:
to:

#### attach to running node process on Windows

NOTE: as of 2013.09.19 this is not official, and there is some discussion about the wording.
As the discussion points out, process._debugProcess() is an undocumented (or internal?) API function and may be subject to change.

Windows does not support UNIX signals. To enable debugging, you can use an undocumented API function process._debugProcess(pid)

1. Get the PID of the node process using your favorite method, e.g.

tasklist /FI "IMAGENAME eq node.exe"

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
node.exe                      3084 Console                    1     11,964 K

2. Call the API:

node -e "process._debugProcess(3084)"

Great! Now you are ready to attach the inspector.

Changed line 129 from:

to:

## Learning

Changed line 189 from:
to:

September 17, 2013, at 02:13 PM by OtherMichael - merged the two debug sections
Changed line 14 from:

to:

Deleted line 15:

https://github.com/node-inspector/node-inspector

Changed lines 17-20 from:
to:

Changed lines 33-34 from:

then browsing to http://localhost:8080/debug?port=5858 in Chrome

to:

then browsing to http://localhost:8080/debug?port=5858 in Chrome

Deleted lines 155-159:

## Debugging

September 17, 2013, at 02:11 PM by OtherMichael -

### node-inspector

https://github.com/node-inspector/node-inspector

On Windows (7), npm-install requires being run as Administrator. This is not an issue of node-inspector so much as a sub-package (ws?) of socket-io.

I was able to run node-inspector on Windows7 without needing to know the PID via the following (after a successful install):

node --debug-brk <file.js> in one shell
node-inspector& in ANOTHER shell

then browsing to http://localhost:8080/debug?port=5858 in Chrome

One or both of my shells may have been run as administrator; do not know if this is required or not (it was for installation)

discovered via post and comment

September 13, 2013, at 02:53 PM by OtherMichael -

## Debugging

https://github.com/node-inspector/node-inspector
http://blog.strongloop.com/announcing-a-new-and-improved-node-js-debugger/

September 06, 2013, at 10:44 AM by OtherMichael -

## package.json

https://blog.nodejitsu.com/package-dependencies-done-right

September 03, 2013, at 04:19 PM by OtherMichael -

Parsing text files using node.js

August 02, 2013, at 11:25 AM by OtherMichael -
Changed lines 26-27 from:

to:

http://flippinawesome.org/2013/07/29/writing-a-command-line-utility-using-node

June 29, 2013, at 05:20 PM by OtherMichael -
Changed lines 27-29 from:

### Jake

https://github.com/mde/jake
http://howtonode.org/intro-to-jake

to:

June 29, 2013, at 05:17 PM by OtherMichael -

### Jake

https://github.com/mde/jake
http://howtonode.org/intro-to-jake

June 29, 2013, at 05:15 PM by OtherMichael -

May 17, 2013, at 04:20 PM by OtherMichael - debugging link, and global vs local install

## npm install global vs local

In general, the rule of thumb is:

1. If you’re installing something that you want to use in your program, using require(‘whatever’), then install it locally, at the root of your project.
2. If you’re installing something that you want to use in your shell, on the command line or something, install it globally, so that its binaries end up in your PATH environment variable.

(source)

## Debugging

May 16, 2013, at 03:14 PM by OtherMichael - global install and finding those packages

I ran into the same problem as this question: npn install -g cannot find module

(:source lang=text:)
module.js:340
throw err;
^
Error: Cannot find module ‘colors’
at Function.Module._resolveFilename (module.js:338:15)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (d:\Dropbox\projects\\util\util.js:6:14)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Function.Module.runMain (module.js:497:10)
(:sourceend:)

And used the same solution:

For anyone else running into this, I had this problem due to my npm installing into a location that’s not on my NODE_PATH.

I did an echo  and saw it was undefined.
As a test, I did set NODE_PATH=c:\users\mpaulukonis\appData\Roaming\npm\node_modules\ in the current, and the file now worked.
I added the env-var to the main user environment variables.

Not so sure about that path, though. looks ugly and funky.
What if.... node modules are on DropBox? Is that a bad idea?
How to change this location?

May 07, 2013, at 01:44 PM by OtherMichael - task automation link

May 06, 2013, at 09:23 AM by OtherMichael -

## Learning

Learn Node.js Completely and with Confidence 0 book recommendations and pace of study based on them

May 03, 2013, at 03:24 PM by OtherMichael -

UPDATE: (a few minutes later) As I wrote the above, I was slightly suspicious, as the upper-left of the launched nodejs instance looked like the putty logo.

It is.

I looked at the source code, and saw that it had an INVARIANT launch of putty if the environment was windows (which mine is).

I tried the .cmd file a second time, and it launched fine.
Not sure what happened the first time around.
I _should have_ grabbed a screencap.

May 03, 2013, at 02:54 PM by OtherMichael -
Changed lines 31-32 from:

https://github.com/Benvie/Node.js-Ultra-REPL

to:

### ultra REPL

https://github.com/Benvie/Node.js-Ultra-REPL

Installation instructions say to use an included .cmd file to launch, but I found it tried to launch PUTTY for no reason I could see (in the, say, 30 seconds I spent worrying about it).

However, the following worked:

1. launch windows shell
2. cd to \path\node_modules\ultra-repl\bin
3. node ultra-repl.js

May 03, 2013, at 02:40 PM by OtherMichael -
Changed line 58 from:
to:

May 03, 2013, at 02:39 PM by OtherMichael -

(:description server-side javascript:)
(:toc-float:)

## node js

http://nodejs.org/

Some notes I’ve seen say to install the 32 bit version on a 64bit system. In some cases, because IIS Express only ships as 32bit. But if you’re not using IIS (Express), can you use 64bit?

I ended up using these notes and not integrating with IIS (yet?).

Since I’m working in Emacs, I’ve been updating notes @ EmacsWiki:NodeJs

I’ve installed node and js-comint, but tab-completion is not supported. Nor in swank-js, AFAIK (which I haven’t tried yet)

## Shell Scripting

http://www.phpied.com/javascript-shell-scripting/

Write your shell scripts in JavaScript, via Node.js

other posts on js-shell-scripting

Transforming HTML with Node.js and jQuery
New Node.js module “lazylines”: read a text stream, line by line

## REPL (Read Eval Print Loop)

http://nodejs.org/docs/v0.3.1/api/repl.html
How do I use node’s REPL?
https://npmjs.org/package/node-web-repl
http://stackoverflow.com/questions/6220420/node-js-multi-line-string
https://github.com/Benvie/Node.js-Ultra-REPL

There are a few special REPL commands:

.break - While inputting a multi-line expression, sometimes you get lost or just don’t care about completing it. .break will start over.
.clear - Resets the context object to an empty object and clears any multi-line expression.
.exit - Close the I/O stream, which will cause the REPL to exit.
.help - A:Show this list of special commands.

http://cs.brown.edu/courses/csci1320/labs/node_lab.html
http://ofps.oreilly.com/titles/9781449398583/chap1_id35940135.html

http://www.nodebeginner.org/
http://stackoverflow.com/questions/2353818/how-do-i-get-started-with-node-js

markov chain module for node.js
https://github.com/exratione/state-engines
https://github.com/substack/node-markov