NodeJs.NodeJs History

Hide minor edits - Show changes to output - Cancel

 
 
January 02, 2018, at 08:29 PM by MichaelPaulukonis -
Added lines 16-18:
As of Dec 2017 I've started using JSCode 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:
[[#ultrarepl]]
!!! 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:
# launch windows shell
# cd to [@\path\node_modules\ultra-repl\bin@]
# [@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.

!! link dump
[[http://cs.brown.edu/courses/csci1320/labs/node_lab.html]]
[[http://ofps.oreilly.com/titles/9781449398583/chap1_id35940135.html]]

[[http://geekswithblogs.net/shaunxu/archive/2012/09/14/node.js-adventure---node.js-on-windows.aspx]]
[[http://www.nodebeginner.org/]]
[[http://stackoverflow.com/questions/2353818/how-do-i-get-started-with-node-js]]

[[http://www.exratione.com/2012/11/of-names-and-markov-chains/|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]]
!! 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 [[Programming/Chocolatey]]: [@cinst nodejs.install@] to install node and npm, [@cup nodejs.install@] to upgrade
to:
Can use [[Programming/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 [[Programming/Chocolatey]]: [@cinst nodejs.install@] to install node and npm
to:
Can use [[Programming/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 [[http://chocolatey.org/packages/nodejs.commandline|[@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 [[http://chocolatey.org/packages/nodejs.commandline|[@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]][[#debug]]
!! Debugging
[[http://blog.strongloop.com/announcing-a-new-and-improved-node-js-debugger/]]
[[https://plus.google.com/114738313102270607087/posts/DGJzWmYPQCR?utm_source=javascriptweekly&utm_medium=email|Debug your Node.js code]]
which points to [[https://github.com/adobe-research/theseus]]


[[#nodeinspector]]
!!! 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 [[http://codebetter.com/glennblock/2011/10/13/using-node-inspector-to-debug-node-js-applications-including-on-windows-and-using-ryppi-for-modules/#comment-413552579|post and comment]]

!!!! [[https://github.com/node-inspector/node-inspector/issues/106|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]]

# [@node --debug-brk "\path\to\node_modules\jake\bin\cli.js" <rest of jake parameters>@]
# [@node-inspector &@]
 
 
November 26, 2013, at 04:28 PM by OtherMichael -
Changed lines 96-98 from:
See also: [[Jake]], [[ShellScripting]]

to:
See also: [[Jake]], [[JavaScript.ShellScripting]]

Changed lines 160-205 from:
!! install global package not found
I ran into the same problem as this question: [[http://stackoverflow.com/questions/12594541/npm-global-install-cannot-find-module|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 Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (d:\Dropbox\projects\WebText\util\util.js:6:14)
    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)
(: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 %NODE_PATH%@@ 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 [[Programming/DropBox]]? Is that a bad idea?
How to change this location?


[[#globalvlocal]]
!! npm install global vs local
>>blockq<<
In general, the rule of thumb is:

# 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.
# 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.

->([[http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/|source]])
>><<


to:

Changed line 173 from:
[[ShellScripting]]
to:
[[JavaScript.ShellScripting]]
 
 
November 21, 2013, at 11:42 AM by OtherMichael - update on chocolatey
Changed lines 20-21 from:
Can use [[Programming/Chocolatey]]: [@cinst nodejs@]
to:
Can use [[Programming/Chocolatey]]: [@cinst nodejs.install@] to install node and npm
Chocolately's [@nodejs@] is an alias for [[http://chocolatey.org/packages/nodejs.commandline|[@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:
[[#upgrade]]
!!! upgrading
to:
[[#upgrade]][[#install]][[#installation]]
!!! upgrading & installation
Added lines 19-21:

Can use [[Programming/Chocolatey]]: [@cinst nodejs@]

 
 
November 20, 2013, at 01:41 PM by OtherMichael -
Added lines 205-209:


[[#shared]]
!! 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 -
Added lines 19-22:

!! link dump
[[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:
[[http://nodeschool.io/|nodeschool.io]] - provides (via [@npm@]) four command-line based "lesson plans"
to:
[[http://nodeschool.io/|nodeschool.io]] - provides (via [@npm@]) four command-line based "lesson plans" (here's a [[http://css.dzone.com/articles/check-out-nodeschoolio|review]])
 
 
November 13, 2013, at 11:13 AM by OtherMichael - nodeschoool.io
Changed lines 142-149 from:
[[http://javascriptissexy.com/learn-node-js-completely-and-with-confidence/|Learn Node.js Completely and with Confidence]] 0 book recommendations and pace of study based on them
to:
[[http://javascriptissexy.com/learn-node-js-completely-and-with-confidence/|Learn Node.js Completely and with Confidence]] - book recommendations and pace of study based on them

[[http://nodeschool.io/|nodeschool.io]] - provides (via [@npm@]) four command-line based "lesson plans"
# Learn You the Node.js For Much Win!
** [[http://r.va.gg/2013/08/learn-you-the-node.js.html|Learn you the Node.Js]] workshop notes
# Stream Adventure
# Level Me Up Scotty
# Functional Javascript
 
 
October 23, 2013, at 03:19 PM by OtherMichael - installation header, and upgrade note
Added line 7:
[[#installation]]
Added lines 15-19:

[[#upgrade]]
!!! upgrading
(on windows, at least) Just run the latest installer.

 
 
September 19, 2013, at 01:22 PM by OtherMichael - node-inspector jake
Added lines 60-65:

!!!! Node-inspector for jakefiles
[[https://github.com/mde/jake/issues/226]]

# [@node --debug-brk "\path\to\node_modules\jake\bin\cli.js" <rest of jake parameters>@]
# [@node-inspector &@]
 
 
September 19, 2013, at 09:08 AM by OtherMichael -
Added line 2:
(:title node.js:)
Changed lines 40-60 from:
to:
!!!! [[https://github.com/node-inspector/node-inspector/issues/106|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:
!! Learning
to:
!! Learning
Changed line 189 from:
[[!JavaScript]] [[!shell]] [[!scripting]] [[!serverside]]
to:
[[!JavaScript]] [[!shell]] [[!scripting]] [[!serverside]]
 
 
September 17, 2013, at 02:13 PM by OtherMichael - merged the two debug sections
Changed line 14 from:
[[#debugging]]
to:
[[#debugging]][[#debug]]
Deleted line 15:
[[https://github.com/node-inspector/node-inspector]]
Changed lines 17-20 from:
to:
[[https://plus.google.com/114738313102270607087/posts/DGJzWmYPQCR?utm_source=javascriptweekly&utm_medium=email|Debug your Node.js code]]
which points to [[https://github.com/adobe-research/theseus]]

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:

[[#debug]]
!! Debugging
[[https://plus.google.com/114738313102270607087/posts/DGJzWmYPQCR?utm_source=javascriptweekly&utm_medium=email|Debug your Node.js code]]
which points to [[https://github.com/adobe-research/theseus]]
 
 
September 17, 2013, at 02:11 PM by OtherMichael -
Added lines 18-35:

[[#nodeinspector]]
!!! 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 [[http://codebetter.com/glennblock/2011/10/13/using-node-inspector-to-debug-node-js-applications-including-on-windows-and-using-ryppi-for-modules/#comment-413552579|post and comment]]
 
 
September 13, 2013, at 02:53 PM by OtherMichael -
Added lines 13-17:

[[#debugging]]
!! 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 -
Added lines 136-140:


[[#package]]
!! [@package.json@]
[[https://blog.nodejitsu.com/package-dependencies-done-right]]
 
 
September 03, 2013, at 04:19 PM by OtherMichael -
Added lines 27-28:

[[http://dhtmlexamples.com/2012/04/12/parsing-text-files-using-node-js/|Parsing text files using node.js]]
 
 
August 02, 2013, at 11:25 AM by OtherMichael -
Changed lines 26-27 from:

See also: [[Jake]]
to:
[[http://flippinawesome.org/2013/07/29/writing-a-command-line-utility-using-node]]

See also: [[Jake]], [[ShellScripting
]]
 
 
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:
See also: [[Jake]]
 
 
June 29, 2013, at 05:17 PM by OtherMichael -
Added lines 25-29:


!!! 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
Added lines 112-129:


[[#globalvlocal]]
!! npm install global vs local
>>blockq<<
In general, the rule of thumb is:

# 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.
# 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.

->([[http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/|source]])
>><<


[[#debug]]
!! Debugging
[[https://plus.google.com/114738313102270607087/posts/DGJzWmYPQCR?utm_source=javascriptweekly&utm_medium=email|Debug your Node.js code]]
which points to [[https://github.com/adobe-research/theseus]]
 
 
May 16, 2013, at 03:14 PM by OtherMichael - global install and finding those packages
Added lines 79-111:


!! install global package not found
I ran into the same problem as this question: [[http://stackoverflow.com/questions/12594541/npm-global-install-cannot-find-module|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 Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (d:\Dropbox\projects\WebText\util\util.js:6:14)
    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)
(: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 %NODE_PATH%@@ 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 [[Programming/DropBox]]? Is that a bad idea?
How to change this location?
 
 
May 07, 2013, at 01:44 PM by OtherMichael - task automation link
Added lines 23-24:

[[http://flippinawesome.org/2013/04/29/task-automation-with-automaton-and-node/|task automation]]
 
 
May 06, 2013, at 09:23 AM by OtherMichael -
Added lines 72-77:


[[#learning]]
!! Learning
[[http://javascriptissexy.com/learn-node-js-completely-and-with-confidence/|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 -
Added lines 50-59:

'''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:
Added lines 39-49:

[[#ultrarepl]]
!!! 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:
# launch windows shell
# cd to [@\path\node_modules\ultra-repl\bin@]
# [@node ultra-repl.js@]
 
 
May 03, 2013, at 02:40 PM by OtherMichael -
Changed line 58 from:
[[!JavaScript]] [[!shell]] [[!scriping]] [[!serverside]]
to:
[[!JavaScript]] [[!shell]] [[!scripting]] [[!serverside]]
 
 
May 03, 2013, at 02:39 PM by OtherMichael -
Added lines 1-58:
(:description server-side javascript:)
(:toc-float:)
!! node js
[[http://nodejs.org/]]

[[http://tomasz.janczuk.org/2011/08/developing-nodejs-applications-in.html|Some]] [[http://stackoverflow.com/questions/12086580/installing-node-exe-in-windows-7|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 [[http://dailyjs.com/2012/05/03/windows-and-node-1/|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)


[[#scripting]]
!! Shell Scripting
[[http://www.phpied.com/javascript-shell-scripting/]]

[[http://www.2ality.com/2011/12/nodejs-shell-scripting.html|Write your shell scripts in JavaScript, via Node.js]]
-> [[http://www.2ality.com/search/label/jsshell|other posts on js-shell-scripting]]
[[http://www.2ality.com/2012/02/jsdom.html|Transforming HTML with Node.js and jQuery]]
[[http://www.2ality.com/2012/02/lazylines.html|New Node.js module “lazylines”: read a text stream, line by line]]


[[#repl]]
!! REPL (Read Eval Print Loop)
[[http://nodejs.org/docs/v0.3.1/api/repl.html]]
[[http://docs.nodejitsu.com/articles/REPL/how-to-use-nodejs-repl|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:
>>lrindent<<
[@.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.
>><<

!! link dump
[[http://cs.brown.edu/courses/csci1320/labs/node_lab.html]]
[[http://ofps.oreilly.com/titles/9781449398583/chap1_id35940135.html]]

[[http://geekswithblogs.net/shaunxu/archive/2012/09/14/node.js-adventure---node.js-on-windows.aspx]]
[[http://www.nodebeginner.org/]]
[[http://stackoverflow.com/questions/2353818/how-do-i-get-started-with-node-js]]

[[http://www.exratione.com/2012/11/of-names-and-markov-chains/|markov chain module for node.js]]
[[https://github.com/exratione/state-engines]]
[[https://github.com/substack/node-markov]]

!! See Also
[[ShellScripting]]


!! Tags
[[!JavaScript]] [[!shell]] [[!scriping]] [[!serverside]]