error while installing npm error for version - react-native

I am trying to install npm to the code i am facing the below issue.
Command i try : npm install
or
npm -g install npm
npm cache clean -f
npm install -g n
below is the error:
sh: patch-package: command not found
npm ERR! code 127
npm ERR! path XXXX
npm ERR! command failed
npm ERR! command sh -c patch-package

If you're using yarn you can run yarn patch-package <args>
Otherwise ./node_modules/.bin/patch-package <args>
Or add ./node_modules/.bin to your $PATH environment variable (I prefer doing this)

Related

Couldn't find the binary git

I am new to react-native.
After I changed "rn-nodeify":"10.3.0" to package.json under devDependencies and run npm install
my project
I followed this tutorial
If I run this command npm i --save-dev rn-nodeify#latest then this npm i --save-dev rn-nodeify#latest the below error occured.
C:\Users\mahima\Desktop\react-native\rn-node-js-master>npm install
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
> NodeJSExampleApp#0.0.1 postinstall
> ./node_modules/.bin/rn-nodeify --install --hack
'.' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code 1
npm ERR! path C:\Users\mahima\Desktop\react-native\rn-node-js-master
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c
./node_modules/.bin/rn-nodeify --install --hack
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\mahima\AppData\Local\npm-cache\_logs\2022-08-29T06_39_05_153Z-debug-0.log
C:\Users\mahima\Desktop\react-native\rn-node-js-master>
How can I solve this error ?
Why not try this in package.json ?
"rn-nodeify":"10.3.0"
or any specific version which you want, usually package.json expects :
[packageName]:[version number]
alternative, why dont you try installing like this from terminal ?
npm i --save-dev rn-nodeify#latest
Make sure you have the GIT installed on your device and accessible globally. Try to type git --version in the CMD. If it returned that the command is not recognized and GIT already installed, then you need to add it to the PATH environment variable and make sure to try the command using a new CMD session

NPM completely broken and won't reinstall after failed upgrade

Mac Catalina 10.15.6
I already had npm installed. I wanted to upgrade so I ran the following.
npm install -g npm
Below is the output:
$name#$names-MacBook-Pro desktop % npm install -g npm
/usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
npm ERR! code EEXIST npm ERR! syscall symlink npm ERR! path
../../../lib/node_modules/npm/man/man1/npm-bin.1 npm ERR! dest
/usr/local/share/man/man1/npm-bin.1 npm ERR! errno -17 npm ERR!
EEXIST: file already exists, symlink
'../../../lib/node_modules/npm/man/man1/npm-bin.1' ->
'/usr/local/share/man/man1/npm-bin.1' npm ERR! File exists:
/usr/local/share/man/man1/npm-bin.1 npm ERR! Remove the existing file
and try again, or run npm npm ERR! with --force to overwrite files
recklessly.
npm ERR! A complete log of this run can be found in: npm ERR!
/Users/$name/.npm/_logs/2020-10-04T14_41_02_611Z-debug.log
Now all NPM commands fail.
zsh: command not found: npm
Everything from:
npm -v
sudo npm install npm -g
I just used home brew to upgrade NPM and it deleted and reinstalled all the necessary files.
This generally works for me on Mac:
brew upgrade
brew cleanup
brew install npm
(note you'll need the xcode tools if you don't have it - try xcode-select --install or check out this answer.)
Now, try npm install again and see if that changes anything.
Also, see this potentially related answer.

Vue CLI error creating new project (npm error)

Please help me on this. I can't create a new Vue CLI project. It previously works good! Now not working...
Vue CLI v4.2.3
✨ Creating project in /Web develop/Vue Projects/new.
🗃 Initializing git repository...
⚙️ Installing CLI plugins. This might take a while...
npm ERR! Unexpected end of JSON input while parsing near '...loader":"~0.8.0","js-'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Malaka/.npm/_logs/2020-03-25T06_30_10_474Z-debug.log
ERROR command failed: npm install --loglevel error
seems a cache error
run
npm cache clean --force
then try create the project again
That's weird. I'd just try re-installing the Vue cli package.
There is a deprecated vue-cli package, it could be you have that installed rather than the official one #vue/cli.
Either way just uninstall it with
npm uninstall [your-vue-cli-package] -g
Then re-install it again.
npm install #vue/cli -g
lets try this
$ sudo npm uninstall -g vue
$ sudo npm uninstall -g vue-cli
$ sudo npm uninstall -g #vue/cli
$ sudo npm cache clean --force
$ sudo npm install -g vue
$ sudo npm install -g #vue/cli
problem log:
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! network Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\DraKoan\AppData\Local\npm-cache\_logs\2022-04-19T17_09_34_388Z-debug-0.log
ERROR Error: command failed: npm install --loglevel error --legacy-peer-deps
Error: command failed: npm install --loglevel error --legacy-peer-deps
at ChildProcess.<anonymous> (C:\Users\DraKoan\AppData\Roaming\npm\node_modules\#vue\cli\lib\util\executeCommand.js:138:16)
at ChildProcess.emit (node:events:526:28)
at ChildProcess.cp.emit (C:\Users\DraKoan\AppData\Roaming\npm\node_modules\#vue\cli\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (node:internal/child_process:1092:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
Solve:
check proxy at config
npm config edit
npm config --global edit
clean and set proxy
npm config set proxy null
npm config set proxy false

Why I can not run Npm run dev?

Guys can you please help me on this I have trouble run npm run dev for my Laravel Mix. I followed links below but still error exist. Do i have a problem on my OS? I tried to remove node_modules, run npm install --global cross-env. and run NPM install again.
'cross-env' is not recognized as an internal or external command,
https://github.com/JeffreyWay/laravel-mix/issues/478
The error I always get when I ran npm run dev :
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # development 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/baloghdominik/.npm/_logs/2020-02-26T17_05_54_290Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # dev 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/baloghdominik/.npm/_logs/2020-02-26T17_05_54_315Z-debug.log
First run
npm install cross-env
npm install
Then run
npm run dev
Simple steps :
npm cache clear --force
delete node_modules and package-lock.json
npm install
npm run dev
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install
Basically delete the node_modules folder and package-lock.json file , clear cache and do an npm install. Worked for me.
In my case I had old version of node.js
so I just installed version I need:
sudo npm install n -g
sudo n stable
Or can try use latest:
sudo n latest
If u using nvm, u need use version for project. Commands helped for me:
Use default version node: nvm use system
Remove node_modules rm -rf node_modules and rm -f package-lock.json
Clear cache npm cache clear --force
Finished command npm i

How can I install web3 globally in Ubuntu 16.04?

I am trying to install web3 via npm.
sudo npm install -g web3
But I faced below error.
tom#ubuntu:/$ sudo npm install -g web3
npm WARN deprecated fs-promise#2.0.3: Use mz or fs-extra^3.0 with Promise
Support
npm WARN deprecated tar.gz#1.0.7: ⚠️ WARNING ⚠️ tar.gz module has been
deprecated and your application is vulnerable. Please use tar module instead:
https://npmjs.com/tar
npm ERR! code 1
npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b browserifyCompatible
git://github.com/frozeman/WebSocket-Node.git
/home/tom/.npm/_cacache/tmp/git-
clone-d38db07b
npm ERR! /home/tom/.npm/_cacache/tmp/git-clone-d38db07b/.git: Permission denied
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /home/tom/.npm/_logs/2018-02-07T14_42_37_459Z-debug.log
How can I install web3?
Looks like your local .npm permissions are messed up. Just remove NPM cache by running:
sudo rm -rf /home/tom/.npm
and then try again.