How can i solve npm error on install -g yarn? - npm

i want to run this command and install yarn
npm install -g yarn
but i get this error
npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\Users\DigiMax\AppData\Roaming\npm\node_modules\yarn
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\DigiMax\AppData\Local\npm-cache\_logs\2021-07-03T15_03_24_683Z-debug.log
how can i solve this problem?

The quickest solution is npm cache clean and npm cache verify works in most cases.
According to docs.npmjs you should check your npm version and update if needed or reinstall it at worst.
Please, let us know if it worked

This problem solve by "running VSCode as administrator"

Related

Can't install / remove / fix / start NPM on Mac

Could anyone please help me with fixing my NPM installation?
It was working a couple of months ago, but then I tried to launch it recently and nothing is working.
I can't install it, or launch it.
I am very new to all this and any help would be highly appreciated.
npm install throws error:
eugenesoch#Eugenes-iMac ~ % npm install
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/eugenesoch/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/eugenesoch/package.json'
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/eugenesoch/.npm/_logs/2023-02-18T17_42_39_222Z-debug-0.log
npm start throws error:
eugenesoch#Eugenes-iMac ~ % npm start
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/eugenesoch/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/eugenesoch/package.json'
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/eugenesoch/.npm/_logs/2023-02-18T17_44_40_679Z-debug-0.log
eugenesoch#Eugenes-iMac ~ %
I tried installing, tried even using sudo npm install, but nothing worked.
As said, I am quite new to all this and might not know everything, so would really appreciate someone pointing me in the right direction.
Many thanks!

How to resolve npm error: npm start not working

i am trying to install "npx create-react-app new" it successfully installs, however "npm start" shows error:
PS D:\react project\new> npm start
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path D:\react project\new/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'D:\react project\new\package.json'
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\user\AppData\Local\npm-cache\_logs\2022-03-15T08_51_51_601Z-debug.log
PS D:\react project\new>
I checked my package.json, it looks fine, anyone can suggest whats the issue here?
First of all run:
npm run start
if it did not work then delete the node-module folder and use
npm i or npm install
this will work for you.

Can't install packages for Hardhat project

I wanted to create a project using Hardhat environment. I've tried following https://hardhat.org/getting-started/ tutorial from their side. In there, we have a TIP to install all required packages. Unfortunately when I run npm install --save-dev #nomiclabs/hardhat-waffle ethereum-waffle chai #nomiclabs/hardhat-ethers ethers first I can see a lot of warnings about deprecated packages and then
npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno -4058
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t https://github.com/ethereumjs/ethereumjs-abi.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git 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\(path)
I've tried installing ethereum-waffle with specific version selected etc. it always ends with the same error.
Do you know how to overcome it? Why so many packages are deprecated during install? Is this getting-started outdated and I should start hardhat project in some other way?
When you run npm install --save-dev #nomiclabs/hardhat-waffle ethereum-waffle chai #nomiclabs/hardhat-ethers ethers , you are installing both. The #nomicfoundation/hardhat-chai-matchers plugin is meant to be a drop-in replacement for the #nomiclabs/hardhat-waffle plugin. So having just one is okay. I recommend you to migrate and use the Hardhat Chai Matchers plugin.
Use this link for more information. => "https://hardhat.org/hardhat-chai-matchers/docs/migrate-from-waffle". I hope this helps out a little bit.

I don't know what going on

I just want to know what is going, whenever I download some react code from github (because I want to check the output for inspiration) and run it using npm start, I see this in the terminal.
What should I do?
sh: react-scripts: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! todo-react#0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the todo-react#0.1.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! /Users/markcornejo/.npm/_logs/2021-05-20T09_35_52_922Z-debug.log
Marks-Air:todo-react-master markcornejo$
Run npm install before npm start, to ensure all the dependencies are installed.

yodoctor: command not found when installing yo from terminal

Below is the error I keep getting. It seems to indicate a "post-install" issue with yodoctor. Sadly yodoctor is the advice given by the yeoman team to help with this issue. I have other node_modules installed (bower, grunt, typescript).
sh: yodoctor: command not found
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/Cellar/node/5.0.0/bin/node" "/usr/local/bin/npm" "install" "-g" "yo"
npm ERR! node v5.0.0
npm ERR! npm v3.3.9
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! yo#1.5.0 postinstall: `yodoctor`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the yo#1.5.0 postinstall script 'yodoctor'.
npm ERR! This is most likely a problem with the yo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! yodoctor
npm ERR! You can get their info via:
npm ERR! npm owner ls yo
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/jesselawson/.node_modules_global/lib/node_modules/npm-debug.log
This error is generally caused because someone used sudo at some point and messed up their npm package directory permissions. As a rule of thumb, never ever use sudo.
So how can you fix it? Here's a couple troubleshooting points:
Make sure you update npm to the latest version (npm install -g npm). npm 2.x had some race conditions that would try to run yodoctor before it is installed.
Make sure the global npm module folders is chown/chmod to your user.
Make sure npm module binaries is in your PATH.
If nothing works, then you can force install it by running npm i -g yeoman-doctor && npm i -g yo - but that really is a last recourse solution.
Just the following command would do the trick:
sudo npm install -g yo
if not, find where yo is, add it to the path as follows:
export PATH="$PATH:<path where yo is installed>"