netcdf doesn't work in Node.js program - javascript

I'm trying to encode a NetCDF file in Node.js program, by using the netcdf(https://www.npmjs.com/package/netcdf) library.
Now, once I run a program, I get an error below.
C:\app [master +2 ~1 -0 !]> npm start
> spaceapps#1.0.0 start C:\app
> node server.js
C:\app\node_modules\text-encoding\lib\encoding.js:979
throw TypeError('Called as a function. Did you forget \'new\'?');
^
TypeError: Called as a function. Did you forget 'new'?
at TypeError (native)
at Object.TextDecoder (C:\app\node_modules\text-encoding\lib\encoding.js:979:13)
at Object.<anonymous> (C:\app\node_modules\netcdf\util\readbinary.js:4:40)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (C:\app\node_modules\netcdf\util\type.js:4:14)
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files (x86)\\Nodist\\v\\nodev5.9.1\\node.exe" "C:\\Program Files (x86)\\Nodist\\bin\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v5.9.1
npm ERR! npm v3.8.7
npm ERR! code ELIFECYCLE
npm ERR! spaceapps#1.0.0 start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the spaceapps#1.0.0 start script 'node server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the spaceapps package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs spaceapps
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls spaceapps
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\app\npm-debug.log
C:\app [master +3 ~1 -0 !]>
It seems there is an error in a library.
I appreciate if someone tells me a solution for it.

As the developer said, He has no plans in the short or medium term to continue development, so you could consider use netcdfjs, that it's a javascript library that allows to read NetCDF v3 files. Because it's a NodeJS package you can run it server side, and for regular size files you can read it online, here you have an example.

Related

Cannot run any npm commands

At first I was getting the following error message on running npm run start inside my project directory.
npm err! code enoent
npm err! syscall spawn bash
npm err!
npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\Users\naray\OneDrive\Desktop\Ananth\Courses\udemy - Node.js, Express, MongoDB & More The Complete Bootcamp 2022\complete-node-bootcamp-master\4-natours\starter-main
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\naray\AppData\Local\npm-cache\_logs\2023-02-03T10_29_53_655Z-debug-0.log
Then I ran npm install -g npm and now I cannot run any npm command. I keep getting the same error message (as shown below) for all npm commands.
node:internal/modules/cjs/loader:946
const err = new Error(message);
^
Error: Cannot find module '../package.json'
Require stack:
C:\\Users\\naray\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli.js
C:\\Users\\naray\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js
at Module.\_resolveFilename (node:internal/modules/cjs/loader:946:15)
at Module.\_load (node:internal/modules/cjs/loader:787:27)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:102:18)
at createEnginesValidation (C:\\Users\\naray\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli.js:7:15)
at module.exports (C:\\Users\\naray\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli.js:78:27)
at Object.\<anonymous\> (C:\\Users\\naray\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js:2:25)
at Module.\_compile (node:internal/modules/cjs/loader:1112:14)
at Module.\_extensions..js (node:internal/modules/cjs/loader:1166:10)
at Module.load (node:internal/modules/cjs/loader:988:32) {
code: 'MODULE_NOT_FOUND',
requireStack: \[
'C:\\Users\\naray\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli.js',
'C:\\Users\\naray\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js'
\]
}
I even tried running npm cache clean --force but got the same message.
Can anyone please help me resolve this?

Error when typing "npm start" in visual studio using react.js

PS C:\Users\PC1\Downloads\portfolio_website-STARTER> npm start
> portfolio_website-starter#1.0.0 start C:\Users\PC1\Downloads\portfolio_website-STARTER
> node index.js
internal/modules/cjs/loader.js:892
throw err;
^
Error: Cannot find module 'C:\Users\PC1\Downloads\portfolio_website-STARTER\index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
at Function.Module._load (internal/modules/cjs/loader.js:745:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! portfolio_website-starter#1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portfolio_website-starter#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\PC1\AppData\Roaming\npm-cache\_logs\2021-09-05T22_40_19_833Z-debug.log
PS C:\Users\PC1\Downloads\portfolio_website-STARTER>
The error shown above happens when I try to run npm start to start the virtual host.
I have tried the following:
Updated node.js to the latest version.
Went to package.json under scripts and added "start": "node index.js".
first, do you install the dependencies? (npm i)
Then, exists index.js file in the portfolio_website-STARTER folder?
First make sure your startup file is index.js in your package.json file and make sure you have index.js in your project.

Microsoft BotBuilder javascript sample error

I am trying to test the Microsoft BotBUilder samples with the Bot Framework Emulator.
I have cloned the BotBuilder repo and gone through the readme instructions npm install but when I run npm start I get this error
/home/ronald/Desktop/botbuilder-samples/samples/javascript_nodejs/02.echo-bot/node_modules/csv-parse/lib/index.js:20
super({...{readableObjectMode: true}, ...opts})
^^^
SyntaxError: Unexpected token ...
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/ronald/Desktop/botbuilder-samples/samples/javascript_nodejs/02.echo-bot/node_modules/csv/lib/index.js:6:10)
npm ERR! Linux 4.15.0-72-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v7.10.1
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! echobot#1.0.0 start: `node ./index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the echobot#1.0.0 start script 'node ./index.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the echobot package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./index.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs echobot
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls echobot
npm ERR! There is likely additional logging output above.
Your running it on Nodejs version 7+ and BotBuilder require 10.14+.
So your node is not able to understand deconstructing operator ....
Try to upgrade your node and it'll works fine.
Can you please try:
super({readableObjectMode: true, ...opts})
I don't think you need to spread the first object.

Nodejs npm scripts fail with "SyntaxError: Unexpected token {"

I've just imported my Reactjs project to a new machine on Ubuntu and installed most dependencies with npm install successfully bar the following:
npm WARN optional Skipping failed optional dependency /react-scripts/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.0.17
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.1.2
Trying to run the project with npm start fails with:
> booking-frontend#0.1.0 start /root/17-visit-booker-frontend
> react-scripts start
/root/17-visit-booker-frontend/node_modules/react-scripts/scripts/start.js:33
const {
^
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3
npm ERR! Linux 4.4.0-81-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! booking-frontend#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the booking-frontend#0.1.0 start script 'react-scripts start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the booking-frontend package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! react-scripts start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs booking-frontend
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls booking-frontend
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /root/17-visit-booker-frontend/npm-debug.log
Attempting to run any npm script including npm run build all fails with the exact same error referencing the same lines in each file in the SyntaxError:
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3
Running the same scripts on my original machine, a Mac, succeed.
I've tried re-installing node/npm which do not fix the issue. Is the supposedly optional dependency causing this to fail?
Any help is appreciated.
You're using node.js v4 which does not by default support destructuring syntax (the const {field1, field2, ....} = object) that it is failing on.
You have two options:
Install a newer version of Node.js
Run node with the harmony flags that will enable this feature in version 4.x.

npm start gives Error: `output.path` needs to be an absolute path or `/`

When i run my first react app using npm start command some error is displayed. Please some one help me to resolve this issue.­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
C:\Users\ankit\Desktop\r3\node_modules\webpack-dev-server\bin\webpack-dev-server.js:386
throw e;
^
Error: `output.path` needs to be an absolute path or `/`.
at Object.setFs (C:\Users\ankit\Desktop\r3\node_modules\webpack-dev-middleware\lib\Shared.js:88:11)
at Shared (C:\Users\ankit\Desktop\r3\node_modules\webpack-dev-middleware\lib\Shared.js:214:8)
at module.exports (C:\Users\ankit\Desktop\r3\node_modules\webpack-dev-middleware\middleware.js:22:15)
at new Server (C:\Users\ankit\Desktop\r3\node_modules\webpack-dev-server\lib\Server.js:56:20)
at startDevServer (C:\Users\ankit\Desktop\r3\node_modules\webpack-dev-server\bin\webpack-dev-server.js:379:12)
at processOptions (C:\Users\ankit\Desktop\r3\node_modules\webpack-dev-server\bin\webpack-dev-server.js:317:3)
at Object.<anonymous> (C:\Users\ankit\Desktop\r3\node_modules\webpack-dev-server\bin\webpack-dev-server.js:441:1)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
npm ERR! Windows_NT 6.2.9200
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v7.5.0
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! r3#1.0.0 start: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the r3#1.0.0 start script 'webpack-dev-server'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the r3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack-dev-server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs r3
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls r3
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\ankit\Desktop\r3\npm-debug.log
The error message is clear: output.path needs to be an absolute path or /
Your output.path should write like this:
var path = require('path');
output: {
path: path.join( __dirname, './dist/'),
}

Categories

Resources