How to properly install the iotivity-node npm package - javascript

I will be very specific and will divide my question into points.
I am running a Ubuntu 14.04 LTS machine with node.js on board
1. What I want to achieve in overall:
I want to install the iotivity-node npm package on my local computer
2. What is not working:
During the installation I get the following logs and errors:
iotivity-node#1.2.1-1 install
/usr/local/lib/node_modules/iotivity-node node-gyp rebuild
make: Entering directory
`/usr/local/lib/node_modules/iotivity-node/build' ACTION Building CSDK
iotivity-installed Cloning into
'/usr/local/lib/node_modules/iotivity-node/iotivity-native'... remote:
Counting objects: 3825, done remote: Finding sources: 100% (3825/3825)
remote: Total 3825 (delta 281), reused 1993 (delta 281) Receiving
objects: 100% (3825/3825), 13.87 MiB | 365.00 KiB/s, done. Resolving
deltas: 100% (281/281), done. Checking connectivity... done. Note:
checking out '0c90ca6ffcbb6a2c56c977ec11bebb7b1d14053b'.
You are in 'detached HEAD' state. You can look around, make
experimental changes and commit them, and you can discard any commits
you make in this state without impacting any branches by performing
another checkout.
If you want to create a new branch to retain commits you create, you
may do so (now or later) by using -b with the checkout command again.
Example:
git checkout -b new_branch_name
Cloning into
'/usr/local/lib/node_modules/iotivity-node/iotivity-native/extlibs/tinycbor/tinycbor'...
error: RPC failed; result=35, HTTP code = 0 fatal: The remote end hung
up unexpectedly make: *** [iotivity-installed] Error 128 make: Leaving
directory /usr/local/lib/node_modules/iotivity-node/build' gyp ERR!
build error gyp ERR! stack Error:make` failed with exit code: 2 gyp
ERR! stack at ChildProcess.onExit
(/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13) gyp ERR! stack at
ChildProcess.emit (events.js:191:7) gyp ERR! stack at
Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Linux 3.13.0-107-generic gyp ERR! command
"/usr/local/bin/node"
"/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js"
"rebuild" gyp ERR! cwd /usr/local/lib/node_modules/iotivity-node gyp
ERR! node -v v6.4.0 gyp ERR! node-gyp -v v3.4.0 gyp ERR! not ok npm
ERR! Linux 3.13.0-107-generic npm ERR! argv "/usr/local/bin/node"
"/usr/local/bin/npm" "install" "-g" "iotivity-node" npm ERR! node
v6.4.0 npm ERR! npm v3.10.8 npm ERR! code ELIFECYCLE
npm ERR! iotivity-node#1.2.1-1 install: node-gyp rebuild npm ERR!
Exit status 1 npm ERR! npm ERR! Failed at the iotivity-node#1.2.1-1
install script 'node-gyp rebuild'. 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 iotivity-node package, npm ERR! not
with npm itself. npm ERR! Tell the author that this fails on your
system: npm ERR! node-gyp rebuild npm ERR! You can get information
on how to open an issue for this project with: npm ERR! npm bugs
iotivity-node npm ERR! Or if that isn't available, you can get their
info via: npm ERR! npm owner ls iotivity-node npm ERR! There is
likely additional logging output above.
3. Did anyone run across this issue while installing iotivity-node and if yes how you have resolved it? Thank you in advance for your answers.

fatal: The remote end hung up unexpectedly
This means it failed to download the code it needs. Just try again - it should work.

Related

Using brain.js in nodejs server but getting error gpu.js not present

I'm using brain.js library for creating Nural network.
Package installed perfectly, but when I ran the server then I get this error.
Cannot find module gpu.js
Then I installed "npm i gpu.js"
Then I got this error - This below error says that install visual studio 2022 latest version and run this in that. I did but didnt worked.
code part
npm WARN deprecated uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code 1
npm ERR! path C:\Users\priya\JSAIML\ytHelper\node_modules\gl
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c prebuild-install || node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#7.1.2
npm ERR! gyp info using node#18.8.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.3 found at "C:\Users\priya\AppData\Local\Programs\Python\Python310\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack at VisualStudioFinder.fail (C:\Users\priya\JSAIML\ytHelper\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
npm ERR! gyp ERR! stack at C:\Users\priya\JSAIML\ytHelper\node_modules\node-gyp\lib\find-visualstudio.js:74:16
npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\priya\JSAIML\ytHelper\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
npm ERR! gyp ERR! stack at C:\Users\priya\JSAIML\ytHelper\node_modules\node-gyp\lib\find-visualstudio.js:70:14
npm ERR! gyp ERR! stack at C:\Users\priya\JSAIML\ytHelper\node_modules\node-gyp\lib\find-visualstudio.js:372:16
npm ERR! gyp ERR! stack at C:\Users\priya\JSAIML\ytHelper\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack at C:\Users\priya\JSAIML\ytHelper\node_modules\node-gyp\lib\util.js:33:16npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:420:5)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1091:16)
npm ERR! gyp ERR! System Windows_NT 10.0.22000
npm ERR! gyp ERR! command "C:\\Users\\priya\\.nvm\\versions\\node\\v18.8.0\\bin\\node.exe" "C:\\Users\\priya\\JSAIML\\ytHelper\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\priya\JSAIML\ytHelper\node_modules\gl
npm ERR! gyp ERR! node -v v18.8.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\priya\AppData\Local\npm-cache\_logs\2023-01-08T17_34_38_565Z-debug-0.log```
this is how my code looks like
code ->
import express from 'express';
import * as brain from 'brain.js/dist/index.js';
import dotenv from 'dotenv'
import ytData from './md/data.js';
dotenv.config()
const app = express()
const PORT = process.env.PORT || 8000
const network = new brain.recurrent.LSTM();
const trainingData = ytData.map((item,i)=>({
input : item.title,
output : item.views,
}))
network.train(trainingData,{iterations : 2000});
const outputData = network.run("Simple Machine Learning With JavaScript - Brain.js")
app.get('/',(req,res)=>{
// res.json({message : `On this title you will probably get around ${outputData} views`})
res.send("hello")
})
app.listen(PORT, ()=>{
console.log(`Running up the hill at ${PORT}km/hr`)
})
**Any help will be appreciated.**

npm install not working, can't install any of the node modules after cloning my project from git

I have cloned my project from git and when trying to do the npm install, it's not working.
I can't fix any of the errors - for example when trying to fix the core-js error with npm install --save core-js#^3 I still get the same message, that I need to upgrade.
Why is this happening? there were no errors before I cloned this repo?
npm WARN deprecated #babel/polyfill#7.12.1: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the #babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
npm WARN deprecated core-js#2.6.12: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm ERR! code 1
npm ERR! path C:\Users\User\Desktop\mydailyprep\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#3.8.0
npm ERR! gyp info using node#14.16.1 | win32 | x64
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: C:\Python\Python39\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "<string>", line 1
npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack ^
npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack at ChildProcess.exithandler (child_process.js:308:12)
npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:315:20)
npm ERR! gyp ERR! stack at maybeClose (internal/child_process.js:1048:16)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
npm ERR! gyp ERR! System Windows_NT 10.0.17134
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\User\\Desktop\\myapp\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\User\Desktop\mydailyprep\node_modules\node-sass
npm ERR! gyp ERR! node -v v14.16.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Local\npm-cache\_logs\2021-04-09T10_33_10_047Z-debug.log
Try :
npm cache clean --force
npm install
Even I faced same kind of issue... might be this may be helpful to you.. :)
I have created a folder called "projects (Folder Name)" in that I have taken the clone of my project - called "xyz project (projects >> xyz project)"..
now by mistake I tried to install - npm install in "projects folder (parent folder)"..
but node modules have to be installed in "xyz project" (child folder)
So when I have used npm i... in xyz project... then node modules have installed SUCCESSFULLY..
Try this..

npm install throws a bunch of errors in react project

I'm currently learning how to work with React and everytime I try to work on a course file and run npm install I get back a million errors and warning. On literally every file I try this on. I've made sure I'm inside the right directory and that there is a json file.
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.4.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jessiematias/Downloads/hooks-videoplayer-starterfiles-master/react-hooks-videoplayer-START/node_modules/webpack-dev-server/node_modules/fsevents
gyp ERR! node -v v12.17.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
I've already tried to reinstall node, update npm to latest version (i'm on 6.14.4) and run npm cache clean but none of those worked. The only thing that worked once was to run a command that was something along the lines of npm install missing dependencies but that's not it, i can't remember it or find it anywhere online now.
You are having a problem with the C compiler of node. Often, this module (node-gyp) is a dependency of one of your dependencies. The problem usually occurs, if not all settings are correctly set. Follow the official installation guide of node-gyp:
Windows: https://github.com/nodejs/node-gyp#on-windows
Mac OS: https://github.com/nodejs/node-gyp#on-macos
You need to install node-gyp
npm install -g node-gyp

Blockstack App Fails on npm install ERR! configure error

I am trying to learn how to use blockstack https://docs.blockstack.org/browser/hello-blockstack.html which is a react.js type of application.
When I build the app and run npm install this is the error I receive:
C:\Users\Davidb.TC\Desktop\blockstack\hello-world-tutorial\node_modules\tiny-secp256k1>if not defined npm_config_node_gyp (node "C:\Users\Davidb.TC\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Users\Davidb.TC\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Python37\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack at ChildProcess.emit (events.js:189:13)
gyp ERR! stack at maybeClose (internal/child_process.js:970:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Davidb.TC\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Davidb.TC\Desktop\blockstack\hello-world-tutorial\node_modules\tiny-secp256k1
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! tiny-secp256k1#1.0.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the tiny-secp256k1#1.0.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Davidb.TC\AppData\Roaming\npm-cache\_logs\2019-04-11T20_16_40_788Z-debug.log
Does anyone know what I must do to fix this error?
These types of node-gyp errors can be caused when Python 3 is installed on the system and it is expecting Python2.7. The node-gyp contributors claim Python3 support is not perfect at the moment and recommend Python2.7 if you encounter any problems.
It may not be necessary though to change Python versions in your case just yet, since it looks like you are on a Windows machine and it's failing on the node-gyp rebuild step. It's probably worth trying the following command first (make sure you are either in CMD or Powershell in Administrator mode:
npm install -g windows-build-tools
The windows-build-tools package is required for node-gyp to work properly on Windows, as stated here. After this, try running npm install again.
Still fails?
If the problem persist or another error related to node-gyp occurs, you might have to install Python2.7 and set npm to use Python2.7
npm config set python /path/to/executable/python2.7
You can read more about possible node-gyp issues and how to resolve them on the node-gyp github page.

Deploying into Heroku node-gyp can not install base64#2.1.0, node-gyp rebuild failed

I'm trying to install a nodejs application in heroku but can not be deployed, because node-gyp rebuild of the base64 library. Any idea to solve this deploy issue.
Works ok locally, the issue is only deploying into heroku. Any ideas to solve it?
Gizras-iMac:negawatt-iec-scraper gizra$ git push heroku master
Fetching repository, done.
Counting objects: 76, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (49/49), done.
Writing objects: 100% (49/49), 11.00 KiB | 0 bytes/s, done.
Total 49 (delta 37), reused 0 (delta 0)
-----> Fetching custom git buildpack... done
-----> Node.js app detected
PRO TIP: Specify a node version in package.json
See https://devcenter.heroku.com/articles/nodejs-support
-----> Defaulting to latest stable node: 0.10.33
-----> Downloading and installing node
-----> Restoring node_modules directory from cache
-----> Pruning cached dependencies not specified in package.json
-----> Node version changed since last build; rebuilding dependencies
> base64#2.1.0 install /tmp/build_fc23248efe5a35c5b79d9762e3733365/node_modules/base64
> node-gyp rebuild
make: Entering directory `/tmp/build_fc23248efe5a35c5b79d9762e3733365/node_modules/base64/build'
CXX(target) Release/obj.target/base64/base64.o
SOLINK_MODULE(target) Release/obj.target/base64.node
SOLINK_MODULE(target) Release/obj.target/base64.node: Finished
COPY Release/base64.node
ACTION binding_gyp_after_build_target_symlink /tmp/build_fc23248efe5a35c5b79d9762e3733365/node_modules/base64/base64.node
ln: creating symbolic link `/tmp/build_fc23248efe5a35c5b79d9762e3733365/node_modules/base64/base64.node': File exists
make: *** [/tmp/build_fc23248efe5a35c5b79d9762e3733365/node_modules/base64/base64.node] Error 1
make: Leaving directory `/tmp/build_fc23248efe5a35c5b79d9762e3733365/node_modules/base64/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/tmp/build_fc23248efe5a35c5b79d9762e3733365/vendor/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Linux 3.8.11-ec2
gyp ERR! command "node" "/tmp/build_fc23248efe5a35c5b79d9762e3733365/vendor/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/build_fc23248efe5a35c5b79d9762e3733365/node_modules/base64
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm ERR! base64#2.1.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the base64#2.1.0 install script.
npm ERR! This is most likely a problem with the base64 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls base64
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.8.11-ec2
npm ERR! command "/tmp/build_fc23248efe5a35c5b79d9762e3733365/vendor/node/bin/node" "/tmp/build_fc23248efe5a35c5b79d9762e3733365/vendor/node/bin/npm" "rebuild"
npm ERR! cwd /tmp/build_fc23248efe5a35c5b79d9762e3733365
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /tmp/build_fc23248efe5a35c5b79d9762e3733365/npm-debug.log
npm ERR! not ok code 0
Old question but I ran into this and solved it via a few routes:
Failed at the base64#2.1.0 install script
Here the base64#2.1.0 might not be compatible with your version of node running your project. Try to install an earlier version.
Delete the ~/.node-gyp folder on your computer (command spacebar and search for ~/.node-gyp) and try reinstalling node-gyp globally.

Categories

Resources