'global' file or directory not found for yarn - linux

When I try to use any command using yarn global, like 'yarn global add yo', I get an error saying ERROR: [Errno 2] No such file or directory: 'global'.
Could not find matching solutions on the internet. Any help will be appreciated. Thanks!

A (alternative) solution:
When I installed yarn using Debian package repository, I got the error mentioned in the question while doing yarn global.
However, when I installed yarn using npm, like this:
npm install -g yarn
I did not get the error anymore upon doing yarn global. Any explanation or detailed answer addressing the issue with installation using Debian package repository is welcome.

Related

An unhandled exception occurred: Cannot find module './browsers' -

I looked for other questions available on stack but was not able to find ans related to this issue.
I have just started Angular and installed things as asked on Udemy course. Creating app and then starting with ng serve.
While I am running ng serve, I am getting below error.
After running npm install I am getting below message.
Can you please guide me to solve this error ?
Thank you very much in advance. :)
well try this one it works for me: npm install --save-dev #angular-devkit/build-angular
If the error message persists after installing packages, it may be due to the NPM settings. In recent versions of the package manager, by default it only installs the packages needed for the production version of the project. The "build-angular" package is a development dependency. If you want to make the website work, you have to tell NPM to install the development packages, by adding the "--only" option with the "dev" version so you should use this command instead:npm i --only=dev
Thank you for above answers.
With below steps followed including avoiding few mistakes, I was able to make it work.
Installed packages in C drive instead of my application folder.
Deleted my old app and recreated it from scratch.
And then when I gave "ng serve" it ran fine.

installing yarn "works" but yarn command is not found

I asked a question previously, but i no longer get that error and simply installing yarn through npm install yarn or npm install -g yarn or npm install --global yarn seems to go through and says this changed 1 package, and audited 2 packages in 334ms .
And when I type yarn it just says zsh: command not found: yarn so i have no clue why.
I have even tried to use nvm but that does nothing, and when I follow the install guide, it seems to "work" then once i close terminal, its gone. This is pretty frustrating because I dont really know how this works and I dont want to ruin anything on my computer either, also with using sudo and what not. Im on an m1 mac if that affects anything. Im really just so confused on this.
use "npm install --global yarn" command.

Unable to resolve "./prebuilt.rn-f9cd27ba.js" from "node_modules\#firebase\firestore\dist\rn\index.js"

I was writing my code and I want some module to be installed so I installed all the required module but after that, I am getting this (Unable to resolve "./prebuilt.rn-f9cd27ba.js" from "node_modules#firebase\firestore\dist\rn\index.js") error again and again so I tried to uninstall all the module which I have installed and I also tried to reinstall, run npm install, and much more but this issue is not fixed pls help
Make sure you are running a modern version of Node.js (or whatever version your project is using (nvm can help with this).
Delete your node_modules directory and run npm install again.

npm 'command not found' no matter what I try

On MacOS:
I'm unable to execute any npm package command. Every time I try, I see command not found. Like so:
-bash: live-server: command not found
I've installed node.js directly from the website.
https://nodejs.org/en/download/
I've installed live-server globally, and locally. It appears to work. When I try the command, it fails.
I've removed node.js and npm, re-installed and still fail to execute a command. I'm quite stumped. I've reviewed similar posts, implemented the suggested solutions and still can't manage to execute any npm command.
Several of the posts I've reviewed:
sudo: npm: command not found
NPM Command Not Found After Installing Node
What should I do next?
Are you using Windows?
Did you check if NPM is in Path on "Environments variable"
My bash_profile file had the wrong data saved. Correcting the file solved the problem.

can't install module 'merge-descriptors'

I'm new to node.js.
I'm using WebStorm. I work on Windows.
I configured my app to run on node.js and when I try to run it I get this error:"Cannot find module 'merge-descriptors'".
I followed these post trying to solve it: How do I resolve "Cannot find module" error using Node.js?,
module.js:338 throw err in node.js
I ran "del /s /q node_modules" (parallel to "rm -rf node_modules").
Now I'm trying to run "npm install -g" and I'm getting this error:
See screen shot below
I've tried to understand it and to look for information about it in the net to no avail.
Any help will be profoundly appreciated!
I had similar issue installing the module, I tried npm install or npm update but my network would timeout. However what I did is very simple:
npm install merge-descriptors --save
When installing the dependencies for a package you should be using npm install and not using the -g flag.
The g flag, or global is used when installing a package globally, which places them in a direct location that is not accessible by the project.
See https://docs.npmjs.com/files/folders
The specific error you're seeing is that the logged in user doesn't have permission to write to the install directory. This can be overcome with sudo command, ex., sudo npm install. But as others have indicated, if you have to do this then something about your app's configuration could be wrong.

Resources