Node.js Issue – RESOLVED

A couple days ago the temperature in the Twin Cities of Minneapolis and St. Paul rose up to 70 F. Yesterday the highs were in the upper 50s. Today the temp is going to go as high as 34 F and will be raining and snowing. Not sure how much snow and rain we will be getting. Hopefully things will not flood.

I am working with micro services and Node.js in order to streamline a storage server currently implemented by three monolith services. We will be going the hybrid route for a while. Eventually all will be implemented with Docker and possibly running on a public cloud (i.e., AWS or Azure).

Earlier today as I was working I wanted to try something with Node.js and for consistency changed npm to version 5.5.1 as illustrated by the following command prompt screen capture:

C:\Users\John\first-app>npm -v
6.4.1       <=== C:\Users\John\first-app>node -v
v10.15.3

C:\Users\John\first-app>npm i -g npm@5.5.1
C:\Users\John\AppData\Roaming\npm\npx -> C:\Users\John\AppData\Roaming\npm\node_modules\npm\bin\npx-cli.js
C:\Users\John\AppData\Roaming\npm\npm -> C:\Users\John\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
+ npm@5.5.1
added 460 packages from 687 contributors in 68.85s

C:\Users\John\first-app>npm -v
5.5.1       <===

In the middle of what I was doing I had to issue the following command:

C:\Users\John\npm-demo>npm init
npm WARN npm npm does not support Node.js v10.15.3
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (npm-demo)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to C:\Users\John\npm-demo\package.json:

{
  "name": "npm-demo",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

Is this ok? (yes)

Something went wrong.

Tried a few things and was not able to restore the previous version on npm. I removed and installed Node.js and npm several times on my Windows 10 machine. For some reason the same version of npm was showing up.

What seem to have worked is as follows:

C:\Program Files\nodejs>npm uninstall -g npm
npm WARN npm npm does not support Node.js v10.15.3
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
removed 460 packages in 12.21s                                                                                les\libnpx

C:\Program Files\nodejs>npm install -g npm
C:\Users\John\AppData\Roaming\npm\npm -> C:\Users\John\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js    odules
C:\Users\John\AppData\Roaming\npm\npx -> C:\Users\John\AppData\Roaming\npm\node_modules\npm\bin\npx-cli.js
+ npm@6.9.0                                                                                                   -stream@2.3.6
added 426 packages from 800 contributors in 46.752s

C:\Program Files\nodejs>npm -v
6.9.0       <====

I uninstalled npm and reinstalled it. As you can see the version is fine. To verify that all was well I repeated the steps that failed to work earlier:

C:\Users\John\npm-demo>npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (npm-demo)
version: (1.0.0)
description:
git repository:
author:
license: (ISC)
About to write to C:\Users\John\npm-demo\package.json:

{
  "name": "npm-demo",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "keywords": [],
  "description": ""
}

Is this OK? (yes)

C:\Users\John\npm-demo>npm init -y
Wrote to C:\Users\John\npm-demo\package.json:

{
  "name": "npm-demo",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "keywords": [],
  "description": ""
}

C:\Users\John\npm-demo>dir
 Volume in drive C is OS
 Volume Serial Number is 26E8-87B0

 Directory of C:\Users\John\npm-demo

04/10/2019  09:53 AM    <DIR>          .
04/10/2019  09:53 AM    <DIR>          ..
04/10/2019  11:33 AM               222 package.json
               1 File(s)            222 bytes
               2 Dir(s)  579,182,813,184 bytes free

C:\Users\John\npm-demo>type package.json
{
  "name": "npm-demo",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "keywords": [],
  "description": ""
}

I can now continue with the Node.js server which is handling API requests for DICOM information.

If you have comments or suggestions regarding the contents in this post, or for that matter on any other post in this blog, or if you need help in any phase of the SDLC for a product or service, feel free to leave me a message below. Requests for help will not be made public.

Keep on reading and experimenting. That is the best way to learn.

John

@john_canessa

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.