Error while installing npm-java on Ubuntu 18.0.4 - npm

I have latest npm 6.7.0 version. I tried to install npm-java module but it gives following error. Here I can see permission issue but I am running it with root permission using sudo. What is the reason for this issue and how to get it fixed?
malintha#malintha-laptop:~$ sudo npm -g install java
> java#0.11.0 install /usr/local/lib/node_modules/java
> node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/java/build'
gyp ERR! System Linux 4.15.0-44-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/java
gyp ERR! node -v v8.9.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! java#0.11.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the java#0.11.0 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! /home/malintha/.npm/_logs/2019-02-04T11_42_36_223Z-debug.log

Solved it removing sudo from the installation command. Just run npm installjava

Related

Sharp returning errors on npm install for M1 Big Sur

I'm trying to install sharp for my project. When running npm i and npm install sharp, I am receiving the same errors about sharp (shown below). I've tried installing libvip globally and locally, and read about every thread about this issue and cannot seem to find the right solution. Any suggestions are welcome.
rosetta error: /var/db/oah/223263137464320_223263137464320/e6ddd63cd8fd3b7ef226e2cad9a1bead9d7f41f60d7ece6edd0cdcc0c33c97c6/libxcrun.dylib.aot: attachment of code signature supplement failed: 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: null
gyp ERR! stack at ChildProcess.onExit (/Users/elektra.murphy/.nvm/versions/node/v11.11.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:197:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Darwin 20.6.0
gyp ERR! command "/Users/elektra.murphy/.nvm/versions/node/v11.11.0/bin/node" "/Users/elektra.murphy/.nvm/versions/node/v11.11.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/elektra.murphy/Desktop/Projects/node_modules/sharp
gyp ERR! node -v v11.11.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/Users/elektra.murphy/Desktop/Projects/package.json'
npm WARN No description
npm WARN No repository field.
npm WARN No README data
npm WARN No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp#0.23.2 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp#0.23.2 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! /Users/elektra.murphy/.npm/_logs/2021-10-12T08_24_48_579Z-debug.log
Found a solution for this in the Sharp docs: When using npm v6 or earlier, the npm install --unsafe-perm flag must be used when installing as root or a sudo user. Seems to have worked - now on to the next error!
Find more here on M1 installations:
https://sharp.pixelplumbing.com/install

While installing Web3js dependency it is showing node-gyp issue

I am trying to install a web3js dependency for my project. But there is an issue coming up with node-gyp.
Below is the error log for that"
> scrypt#6.0.3 preinstall D:\Learning\BlockChain Project\Inbox\node_modules\scrypt
> node node-scrypt-preinstall.js
> scrypt#6.0.3 install D:\Learning\BlockChain Project\Inbox\node_modules\scrypt
> node-gyp rebuild
D:\Learning\BlockChain Project\Inbox\node_modules\scrypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: unable to verify the first certificate
gyp ERR! stack at TLSSocket.onConnectSecure (_tls_wrap.js:1049:34)
gyp ERR! stack at TLSSocket.emit (events.js:182:13)
gyp ERR! stack at TLSSocket._finishInit (_tls_wrap.js:631:8)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Learning\BlockChain Project\Inbox\node_modules\scrypt
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN inbox#1.0.0 No description
npm WARN inbox#1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scrypt#6.0.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scrypt#6.0.3 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\Shashank\AppData\Roaming\npm-cache\_logs\2019-01-19T18_07_03_360Z-debug.log
install windows-build-tools before installing web3 and its dependencies
npm install --global --production windows-build-tools
reference: https://github.com/nodejs/node-gyp
I had to install the above windows-build-tools but had to install with npm install --global --production windows-build-tools --vs2015 as the newer versions of this tool are going to not compile the web3 utils correctly with the node-gyp dependency. I wrangled this one for a while after uninstalling an old install of Visual Studio 2015 a couple of weeks ago.

npm install for Hyperledger Tutorial Fails

I am currently working on a fresh minimal install of Ubuntu 16.0.4 using Hyperledger Fabric. I have pulled down a fresh install of the fabric samples from the Hyperledger documentation site. I have downloaded the following software:
node version 6.9.5
npm version 3.10.10
docker version 17.03.2-ce
golang version 1.7.6 (documentation now calls for newer version, but I think this is unrelated)
I can navigate to the fabcar directory which contains the default npm package.json. I first run ./startFabric as indicated in the instructions. I then run npm install, per the instructions. I then get the error:
u#ubmin2:~/fabric-samples/fabcar$ npm install
npm WARN deprecated crypto#0.0.3: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.
> pkcs11js#1.0.9 install /home/u/fabric-samples/fabcar/node_modules/pkcs11js
> npm run build
> pkcs11js#1.0.9 build /home/u/fabric-samples/fabcar/node_modules/pkcs11js
> node-gyp configure build
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at getNotFoundError (/usr/local/node/lib/node_modules/npm/node_modules/which/which.js:14:12)
gyp ERR! stack at F (/usr/local/node/lib/node_modules/npm/node_modules/which/which.js:69:19)
gyp ERR! stack at E (/usr/local/node/lib/node_modules/npm/node_modules/which/which.js:81:29)
gyp ERR! stack at /usr/local/node/lib/node_modules/npm/node_modules/which/which.js:90:16
gyp ERR! stack at /usr/local/node/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:44:5
gyp ERR! stack at /usr/local/node/lib/node_modules/npm/node_modules/which/node_modules/isexe/access.js:8:5
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15)
gyp ERR! System Linux 4.4.0-96-generic
gyp ERR! command "/usr/local/node/bin/node" "/usr/local/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /home/u/fabric-samples/fabcar/node_modules/pkcs11js
gyp ERR! node -v v6.9.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Linux 4.4.0-96-generic
npm ERR! argv "/usr/local/node/bin/node" "/usr/local/node/bin/npm" "run" "build"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! pkcs11js#1.0.9 build: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pkcs11js#1.0.9 build script 'node-gyp configure build'.
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 pkcs11js package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp configure build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs pkcs11js
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls pkcs11js
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
...
Based on that, it appears that there is a missing pkcs11js module that needs to be included. When I add that module to the package.json file, remove the node_modules file and rerun the "npm install," the error shifts to:
u#ubmin2:~/fabric-samples/fabcar$ npm install
npm WARN deprecated crypto#0.0.3: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.
> pkcs11js#1.0.9 install /home/u/fabric-samples/fabcar/node_modules/pkcs11js
> npm run build
> pkcs11js#1.0.9 build /home/u/fabric-samples/fabcar/node_modules/pkcs11js
> node-gyp configure build
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at getNotFoundError (/usr/local/node/lib/node_modules/npm/node_modules/which/which.js:14:12)
gyp ERR! stack at F (/usr/local/node/lib/node_modules/npm/node_modules/which/which.js:69:19)
gyp ERR! stack at E (/usr/local/node/lib/node_modules/npm/node_modules/which/which.js:81:29)
gyp ERR! stack at /usr/local/node/lib/node_modules/npm/node_modules/which/which.js:90:16
gyp ERR! stack at /usr/local/node/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:44:5
gyp ERR! stack at /usr/local/node/lib/node_modules/npm/node_modules/which/node_modules/isexe/access.js:8:5
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15)
gyp ERR! System Linux 4.4.0-96-generic
gyp ERR! command "/usr/local/node/bin/node" "/usr/local/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /home/u/fabric-samples/fabcar/node_modules/pkcs11js
gyp ERR! node -v v6.9.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Linux 4.4.0-96-generic
npm ERR! argv "/usr/local/node/bin/node" "/usr/local/node/bin/npm" "run" "build"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! pkcs11js#1.0.9 build: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pkcs11js#1.0.9 build script 'node-gyp configure build'.
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 pkcs11js package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp configure build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs pkcs11js
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls pkcs11js
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! Please include the following file with any support request:
npm ERR! /home/u/fabric-samples/fabcar/node_modules/pkcs11js/npm-debug.log
fabcar#1.0.0 /home/u/fabric-samples/fabcar
...
Does anyone understand why npm install is failing to run as expected?
------UPDATE------
in response to christo4ferris, sorry, I should have shown that as well. I've tried many things including installing and removing make. when I install make, I still get an error:
npm WARN fabcar#1.0.0 No repository field.
npm ERR! Linux 4.4.0-96-generic
npm ERR! argv "/usr/local/node/bin/node" "/usr/local/node/bin/npm" "install"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! path /home/u/fabric-samples/fabcar/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/home/u/fabric-samples/fabcar/node_modules'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, access '/home/u/fabric-samples/fabcar/node_modules'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/home/u/fabric-samples/fabcar/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /home/u/fabric-samples/fabcar/npm-debug.log
And then, when I run as sudo us to run as root, I get this error message:
root#ubmin2:/home/u/fabric-samples/fabcar# npm install
npm WARN deprecated crypto#0.0.3: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.
> pkcs11js#1.0.9 install /home/u/fabric-samples/fabcar/node_modules/pkcs11js
> npm run build
> pkcs11js#1.0.9 build /home/u/fabric-samples/fabcar/node_modules/pkcs11js
> node-gyp configure build
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/6.9.5"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/u/fabric-samples/fabcar/node_modules/pkcs11js/.node-gyp"
make: Entering directory '/home/u/fabric-samples/fabcar/node_modules/pkcs11js/build'
CXX(target) Release/obj.target/pkcs11/src/main.o
make: g++: Command not found
pkcs11.target.mk:107: recipe for target 'Release/obj.target/pkcs11/src/main.o' failed
make: *** [Release/obj.target/pkcs11/src/main.o] Error 127
make: Leaving directory '/home/u/fabric-samples/fabcar/node_modules/pkcs11js/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/node/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:215:12)
gyp ERR! System Linux 4.4.0-96-generic
gyp ERR! command "/usr/local/node/bin/node" "/usr/local/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /home/u/fabric-samples/fabcar/node_modules/pkcs11js
gyp ERR! node -v v6.9.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Linux 4.4.0-96-generic
npm ERR! argv "/usr/local/node/bin/node" "/usr/local/node/bin/npm" "run" "build"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! pkcs11js#1.0.9 build: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pkcs11js#1.0.9 build script 'node-gyp configure build'.
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 pkcs11js package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp configure build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs pkcs11js
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls pkcs11js
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! Please include the following file with any support request:
npm ERR! /home/u/fabric-samples/fabcar/node_modules/pkcs11js/npm-debug.log
fabcar#1.0.0 /home/u/fabric-samples/fabcar
Thank you.
The issue was that I was missing a necessary c++ compiler. It seems it was not included in the Ubuntu minimal installation, which makes sense, but the errors seemed very opaque. Running sudo apt install build-essential g++ seems to have solved the problem.
I'm not sure if it was necessary, but I also needed to add alias sudo='sudo env PATH=$PATH' to my .bashrc file so I could run npm with sudo. That solution came from this link.

node gyp rebuild fail

im trying to install a nodejs application but I keep getting the same error about "node-gyp" failing to rebuild.
I dont know a lot about nodejs, apart from I can get this to work on my local machine fine but I cant figure out why it wont run on the server.
Ubuntu 14.04
Node v0.12.5
npm v2.11.2
> ws#0.4.32 install /root/banquo-server/node_modules/node-phantom/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory `/root/banquo-server/node_modules/node-phantom/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build'
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
make: Leaving directory `/root/banquo-server/node_modules/node-phantom/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build'
> ref#1.0.2 install /root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref
> node-gyp rebuild
make: Entering directory `/root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref/build'
CXX(target) Release/obj.target/binding/src/binding.o
make: g++: Command not found
make: *** [Release/obj.target/binding/src/binding.o] Error 127
make: Leaving directory `/root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref/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:269:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 3.13.0-52-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/banquo-server/node_modules/exec-sync/node_modules/ffi/node_modules/ref
gyp ERR! node -v v0.12.5
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
npm ERR! Linux 3.13.0-52-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v0.12.5
npm ERR! npm v2.11.2
npm ERR! code ELIFECYCLE
npm ERR! ref#1.0.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ref#1.0.2 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the ref 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 ref
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /root/banquo-server/npm-debug.log
Any help much appreciated.
Regards
Luke
It seems you have a conflict with an older package that is getting in the way.
Try below commands helped me to resolve the issue, might help you too... these commands might need sudo access
npm cache clean -f
npm install -g n
n stable
npm install npm -g
So above solves the problem when there is any conflict in packages version.... but by looking at logs it says make: g++: Command not found Which means you need to install developer tools
have you tried installing node-gyp via apt-get install:
apt-get install node-gyp
The command g++ is not found, so you need to install the g++ package (along with build-essential which includes other packages that are required to build/compile programs):
sudo apt-get install build-essential g++

Not able to install bcrypt

aakanksha#aakanksha:~/Documents/shoutbox/node_modules$ sudo npm install bcrypt
> bcrypt#0.8.1 install / /home/aakanksha/Documents/shoutbox/node_modules/bcrypt
> node-gyp rebuild
make: Entering directory ` /home/aakanksha/Documents/shoutbox/node_modules/bcrypt/build'
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
make: g++: Command not found
make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 127
make: Leaving directory `/home/aakanksha/Documents/shoutbox/node_modules/bcrypt/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/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:820:12)
gyp ERR! System Linux 3.13.0-44-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node- gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/aakanksha/Documents/shoutbox/node_modules/bcrypt
gyp ERR! node -v v0.10.36
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
npm ERR! Linux 3.13.0-44-generic
npm ERR! argv "node" "/usr/bin/npm" "install" "bcrypt"
npm ERR! node v0.10.36
npm ERR! npm v2.6.0
npm ERR! code ELIFECYCLE
npm ERR! bcrypt#0.8.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#0.8.1 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the bcrypt 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 bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/aakanksha/Documents/shoutbox/node_modules/npm- debug.log
I am getting this error while installing bcrypt.I have tried following things:
npm install -g npm
sudo npm i -g node-gyp && node-gyp clean
But even after running above commands,if i agin install bcrypt it gives me error.