Cannot Install NPM Package - Code 128 An unknown git error occurred - node.js

I'm trying to install the package #truffle/hdwallet-provider .
As written in the doc, I'm running:
npm i #truffle/hdwallet-provider
Here is the error message I'm getting:
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git#github.com/ethereumjs/ethereumjs-abi.git
npm ERR! git#github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-03-08T14_13_15_122Z-debug-0.log
Here are the logs:
698 verbose Linux 5.13.0-30-generic
699 verbose argv "/usr/bin/node" "/usr/bin/npm" "i" "#truffle/hdwallet-provider"
700 verbose node v14.17.6
701 verbose npm v8.5.3
702 error code 128
703 error An unknown git error occurred
704 error command git --no-replace-objects ls-remote ssh://git#github.com/ethereumjs/ethereumjs-abi.git
705 error git#github.com: Permission denied (publickey).
705 error fatal: Could not read from remote repository.
705 error
705 error Please make sure you have the correct access rights
705 error and the repository exists.
706 verbose exit 128
707 timing npm Completed in 6266ms
708 verbose unfinished npm timer reify 1646748520075
709 verbose unfinished npm timer reify:loadTrees 1646748520084
710 verbose code 128
711 error A complete log of this run can be found in:
711 error /root/.npm/_logs/2022-03-08T14_08_39_958Z-debug-0.log
My node version:
v14.17.6
My NPM version:
v8.5.3

Actually, it's a well-known bug.
https://github.com/trufflesuite/truffle/issues/2852
Using this solved the problem:
npm i #truffle/hdwallet-provider#next

For other people coming here for the same bug with another package, check this SO post:
npm install error code 128

Try npm config set legacy-peer-deps true, that worked for me.

Related

I am having a problem in circle-ci and I have been working for hours and can not resolve it

I have a project that I need to build CICD for it, the project is not my code and I should not be changing anything in it
The link to the project is : https://github.com/udacity/cdond-c3-projectstarter
I have build the config.yml for it as following
jobs:
build-frontend:
docker:
- image: cimg/node:13.8.0
steps:
- checkout
- restore_cache:
keys: [frontend-build]
- run:
name: Build front-end
command: |
cd frontend
npm install
npm audit fix --force
npm run build
exit 1
- save_cache:
paths: [frontend/node_modules]
key: frontend-build
build-backend:
docker:
- image: cimg/node:13.8.0
steps:
- checkout
- restore_cache:
keys: [backend-build]
- run:
name: Back-end build
command: |
cd backend
npm install
npm audit fix --force
npm run build
exit 1
- save_cache:
paths: [backend/node_modules]
key: backend-build
but I keep getting this error
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-native-template-redux-typescript#3.4.0 build: webpack --mode development --progress --colors
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-native-template-redux-typescript#3.4.0 build 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/circleci/.npm/_logs/2022-11-14T18_06_06_579Z-debug.log
Exited with code exit status 1
CircleCI received exit code 1
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! glee2#1.0.0 build: `tsc`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the glee2#1.0.0 build 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/circleci/.npm/_logs/2022-11-14T19_21_45_828Z-debug.log
Exited with code exit status 2
CircleCI received exit code 2
error code ERESOLVE
122 error ERESOLVE could not resolve
123 error
124 error While resolving: [1mglee2[22m#[1m1.0.0[22m
124 error Found: [1m#nestjs/cqrs[22m#[1m9.0.1[22m[2m[22m
124 error [2mnode_modules/#nestjs/cqrs[22m
124 error [1m#nestjs/cqrs[22m#"[1m^6.1.0[22m" from the root project
124 error
124 error Could not resolve dependency:
124 error [1m#nestjs/cqrs[22m#"[1m^6.1.0[22m" from the root project
124 error
124 error Conflicting peer dependency: [1mreflect-metadata[22m#[1m0.1.12[22m[2m[22m
124 error [2mnode_modules/reflect-metadata[22m
124 error [35mpeer[39m [1mreflect-metadata[22m#"[1m0.1.12[22m" from [1m#nestjs/cqrs[22m#[1m6.1.0[22m[2m[22m
124 error [2mnode_modules/#nestjs/cqrs[22m
124 error [1m#nestjs/cqrs[22m#"[1m^6.1.0[22m" from the root project
124 error
124 error Fix the upstream dependency conflict, or retry
124 error this command with --force, or --legacy-peer-deps
124 error to accept an incorrect (and potentially broken) dependency resolution.
124 error
124 error See /Users/amira/.npm/eresolve-report.txt for a full report.
125 verbose exit 1

When upgrading node from 6 to latest, npm i fails with ENOENT in react native project

When upgrading to newer versions of npm from 6.14 to latest on react native project
Using node 14, nvm to switch node versions, ideally i'd like to go to node 16, but a similar issue happens regardless of 14 or 16 when updating npm in particular.
I'm also using homebrew on mac M1
I notice the Jetify command asks me:
Jetifier found 1390 file(s) to forward-jetify. Using 8 workers...
Need to install the following packages:
pod
Ok to proceed? (y)
when i select y, npm i fails. I've cleared cache's and removed node_modules. normal cache clearing attempts don't seem to work.
npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /Users/user/.npm/_npx/a0ca5f5666585aa2/node_modules/pod/node_modules/pm2/bin/pm2
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/Users/user/.npm/_npx/a0ca5f5666585aa2/node_modules/pod/node_modules/pm2/bin/pm2'
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! /Users/user/.npm/_logs/2022-01-28T21_51_28_303Z-debug-0.log
npm ERR! code 254
npm ERR! path /Users/user/repos/MyApp/My-MobileApp
npm ERR! command failed
npm ERR! command sh -c npx jetify && cd ios && npx pod install && cd .. && ./node_modules/.bin/patch-package
Here is part of the complete log -
3325 timing reify:rollback:retireShallow Completed in 0ms
3326 timing command:exec Completed in 42372ms
3327 verbose stack Error: ENOENT: no such file or directory, chmod '/Users/user/.npm/_npx/a0ca5f5666585aa2/node_modules/pod/node_modules/pm2/bin/pm2'
3328 verbose cwd /Users/user/repos/MyApp/MyApp-MobileApp/ios
3329 verbose Darwin 21.2.0
3330 verbose argv "/Users/user/.nvm/versions/node/v14.18.3/bin/node" "/Users/user/.nvm/versions/node/v14.18.3/lib/node_modules/npm/bin/npm-cli.js" "exec" "--" "pod" "install"
3331 verbose node v14.18.3
3332 verbose npm v8.4.0
3333 error code ENOENT
3334 error syscall chmod
3335 error path /Users/user/.npm/_npx/a0ca5f5666585aa2/node_modules/pod/node_modules/pm2/bin/pm2
3336 error errno -2
3337 error enoent ENOENT: no such file or directory, chmod '/Users/user/.npm/_npx/a0ca5f5666585aa2/node_modules/pod/node_modules/pm2/bin/pm2'
3338 error enoent This is related to npm not being able to find a file.
3338 error enoent
3339 verbose exit -2
3340 timing npm Completed in 42533ms
3341 verbose unfinished npm timer reify 1643406718315
3342 verbose unfinished npm timer reify:build 1643406730346
3343 verbose unfinished npm timer build 1643406730346
3344 verbose unfinished npm timer build:deps 1643406730347
3345 verbose unfinished npm timer build:link 1643406730354
3346 verbose unfinished npm timer build:link:node_modules/pod 1643406730356
3347 verbose code -2
3348 error A complete log of this run can be found in:
3348 error /Users/user/.npm/_logs/2022-01-28T21_51_28_303Z-debug-0.log
It looks like the error is related to not finding the pm2 package from pod dependency.
Not sure if this will work properly with npx, you might need to install pod globally to get this working.
npm install pod -g
pod install // instead of npx pod install
https://www.npmjs.com/package/pod#installation
Try npm rebuild they say to use "only when you upgrade the node version and must recompile"
hello i once faced this type of issue and issue was actually because pm2 or some other package or processes on old node which was used in your app wasnt found in the updated node version
Reinstall your pm2 package and other package used by your old node in your code again and try again
let me know if this helps you

Push to Heroku failed - error fsevents#0.2.0 install: `node-gyp rebuild`

I'm trying to push my app to Heroku but I keep getting this error, looks like an issue with node-gyp but no idea how to go about fixing it.
2854 verbose rebuildBundles fsevents#0.2.0
2855 verbose rebuildBundles [ 'nan' ]
2856 info install fsevents#0.2.0
2857 verbose unsafe-perm in lifecycle true
2858 info fsevents#0.2.0 Failed to exec install script
2859 error fsevents#0.2.0 install: `node-gyp rebuild`
2859 error Exit status 1
2860 error Failed at the fsevents#0.2.0 install script.
2860 error This is most likely a problem with the fsevents package,
2860 error not with npm itself.
2860 error Tell the author that this fails on your system:
2860 error node-gyp rebuild
2860 error You can get their info via:
2860 error npm owner ls fsevents
2860 error There is likely additional logging output above.
2861 error System Linux 3.8.11-ec2
2862 error command "/tmp/build_31f84d3a-9303-49cd-9596-cc7e984d9e18/vendor/node/bin/node" "/tmp/build_31f84d3a-9303-49cd-9596-cc7e984d9e18/vendor/node/bin/npm" "rebuild"
2863 error cwd /tmp/build_31f84d3a-9303-49cd-9596-cc7e984d9e18
2864 error node -v v0.10.28
2865 error npm -v 1.4.9
2866 error code ELIFECYCLE
2867 verbose exit [ 1, true ]
! Push rejected, failed to compile Node.js app
fsevents is a Mac OS X only extension and fails to install on Heroku (Linux). Try making the dependency optional using optionalDependencies in package.json.

not able to install npm without sudo

I've installed node into a custom directory in my home folder called local per these instructions : https://gist.github.com/isaacs/579814
I've added the location to my PATH and it seems to work fine. I cannot however seem to get npm to install without sudo. From what I can tell it is trying to execute a command in /bin folder.
The command I am running from ~/local/npm is make install and I got the latest versions of both node and npm from github.
Can anyone assist here?
user#localhost [~/local/npm]# make install
rm -rf \
.building_ronn \
html/doc \
html/api \
man
scripts/doc-build.sh doc/api/npm-view.md man/man3/npm-view.3
make[1]: Entering directory `/home1/extrabol/local/npm'
node cli.js install ronn --no-global
npm ERR! Error: EROFS, mkdir '/bin/node'
npm ERR! at Error (native)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Linux 3.4.87-20140414.1.bh6.x86_64
npm ERR! command "node" "/home1/extrabol/local/npm/cli.js" "install" "ronn" "--no-global"
npm ERR! cwd /home1/extrabol/local/npm
npm ERR! node -v v0.11.14-pre
npm ERR! npm -v 1.4.10
npm ERR! path /bin/node
npm ERR! code EROFS
npm ERR! errno -30
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home1/extrabol/local/npm/npm-debug.log
npm ERR! not ok code 0
The Debug Log reports this
0 info it worked if it ends with ok
1 verbose cli [ 'node',
1 verbose cli '/home1/extrabol/local/npm/cli.js',
1 verbose cli 'install',
1 verbose cli 'ronn',
1 verbose cli '--no-global' ]
2 info using npm#1.4.10
3 info using node#v0.11.14-pre
4 verbose node symlink /home1/extrabol/local/node/node
5 error Error: EROFS, mkdir '/bin/node'
5 error at Error (native)
6 error If you need help, you may report this *entire* log,
6 error including the npm and node versions, at:
6 error <http://github.com/npm/npm/issues>
7 error System Linux 3.4.87-20140414.1.bh6.x86_64
8 error command "node" "/home1/extrabol/local/npm/cli.js" "install" "ronn" "--no-global"
9 error cwd /home1/extrabol/local/npm
10 error node -v v0.11.14-pre
11 error npm -v 1.4.10
12 error path /bin/node
13 error code EROFS
14 error errno -30
Figured it out. Looks like when I git cloned the npm files somehow I didn't have ownership over all of the files. a quick chown -R on the npm folder fixed the issue.

npm install now failed OSX 10.8

As title states I cannot install 'nowjs' with npm on my OSX ML 10.8.
Before to make anyone shout out :) I have xCode installed AND command line utilities.
These are lines from npm-log with error messages.
334 verbose true,/Volumes/Macintosh HD2/Library/Node/TestExpress/node_modules,/Volumes/Macintosh HD2/Library/Node/TestExpress/node_modules unbuild now#0.8.1
335 info postuninstall now#0.8.1
336 error node-proxy#0.6.0 install: `node-gyp configure build`
336 error `sh "-c" "node-gyp configure build"` failed with 1
337 error Failed at the node-proxy#0.6.0 install script.
337 error This is most likely a problem with the node-proxy package,
337 error not with npm itself.
337 error Tell the author that this fails on your system:
337 error node-gyp configure build
337 error You can get their info via:
337 error npm owner ls node-proxy
337 error There is likely additional logging output above.
338 error System Darwin 12.2.0
339 error command "node" "/usr/local/bin/npm" "install" "now"
340 error cwd /Volumes/Macintosh HD2/Library/Node/TestExpress
341 error node -v v0.8.14
342 error npm -v 1.1.65
343 error code ELIFECYCLE
344 verbose exit [ 1, true ]
Anyone can point me to the righr direction please?
Sometimes node-proxy (so in this case nowjs), needs to be installed with sudo.

Resources