Yarn equivalent of `npm access` - npm

What is the yarn equivalent of the npm access command? I want to grant a team write permissions to a package I am publishing to NPM via yarn publish. Thank you.

Related

How would you execute npm install with a specific version from the nexus repo

How to execute npm install with a specific version from the nexus repo?
My artifacts are stored in Nexus. what I need to do is execute npm install <nexus version>. However when I do this it still uses my latest package.json that I committed. I want to use all artifacts including package.json from the version in my nexus repo.
Using npm via NXRM behaves the same as using npm without NXRM as far as installs go. You can use npm install package#version.
So for example, npm install pluto#0.4.0.
See npm install doc for more details.

Error while installing expo-cli with npm and yarn

I don't know whats's wrong with my system I am trying to setup expo-cli with yarn global add expo-cli the expo init projectname doesn't work and its getting me same problem when I am trying to install with sudo npm install expo-cli --global?
This is the problem with yarn https://i.stack.imgur.com/q518S.png
&
This is the problem with npm https://i.stack.imgur.com/ojF0h.png
yarn install worked but directory where yarn puts executables for packages is not added to your PATH. If you add it there it should work.
If you want to go with npm, I would strongly recommend to never run npm install with sudo. Use tools like nvm or volta. It will install node, npm and all other packages in your home directory, it should solve all issues with permissions without giving access to your entire system.
https://github.com/nvm-sh/nvm
Try avoiding the global npm install with npx expo-cli
Alternatively, try sudo npm install -g --unsafe-perm expo-cli to install the package globally through root. This seems to be a common error with Ubuntu, more information can be found here: https://github.com/expo/expo-cli/issues/591

How can I see all the 'npm WARN' that comes up after npm install?

I want to see the warnings that comes up after npm install, but without calling npm install. Is there a command I can use for that?
You can use npm install --dry-run to
report in the usual way what the install would have done without actually installing anything.
Npm install
You could also use npm audit for security warnings.
Npm audit

NPM: ENOENT: no such file or directory, rename

I was using gulp on the project, then i decide to deleted all the dev dependencies to switch to webpack, but every time i try to install using npm is get this error:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.3 (node_modules\fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Error: EPERM: operation not permitted, rename 'C:\Users\MiguelFrias\Desktop\Therabytes\node_modules\.staging\fsevents-e80c4ef4\node_modules\are-we-there-yet' -> 'C:\Users\MiguelFrias\Desktop\Therabytes\node_modules\.staging\are-we-there-yet-5db4c798'
npm ERR! path C:\Users\MiguelFrias\Desktop\Therabytes\node_modules\acorn
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\MiguelFrias\Desktop\Therabytes\node_modules\acorn' -> 'C:\Users\MiguelFrias\Desktop\Therabytes\node_modules\.acorn.DELETE'
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\MiguelFrias\AppData\Roaming\npm-cache\_logs\2018-04-04T11_54_23_587Z-debug.log
any idea what can be happening.
just delete package-lock.json file and then install packages, that's all you need and should be works
rm package-lock.json && npm i
When I got this error I looked for all running instances of node in my task manager (i use process explorer on windows) and close/kill all running instances of node. For me its often webstorm or vs code. After closing these programs and ensuring there is no running node process npm install works again.
cache verify command resolved the issue for me
npm cache verify
I remove node_modules and package_lock.json. Then, npm install and it works
Iam using
-node v15.5.0
-npm v6.14.10
Try this:
close "expo start"
remove "package-lock.json"
Try to install packages now
example: npm i #react-navigation/native
This will fix the issue.
The simplest fix for me was:
npm uninstall -g
Then:
npm install -g
The second line may give a hint on what's happening:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Error: EPERM: operation not permitted, rename 'C:\Users\MiguelFrias\Desktop\Therabytes\node_modules\.staging\fsevents-e80c4ef4\node_modules\are-we-there-yet' -> 'C:\Users\MiguelFrias\Desktop\Therabytes\node_modules\.staging\are-we-there-yet-5db4c798'
It looks like npm doesn't have enough permission on the folder you're trying to use.
You can try:
Delete the npm_modules again.
Open whatever editor/terminal you're using to npm install with admin permission.
I found a solution for the problem, apparently is some kinda problem with the last version of npm, i was using npm version 5.6.0 and i downgraded to npm version 5.3.0. This did work after all, after intall a couple packages i still get the same error.
ok change version of npm for the last version 5.8.0 now everything working just perfect, before was some kind of problem with atom that denied the permission the building process to install the dependencies of the package.
I just retried to run
npm install
and it succeeded
For me, package-lock.json was not created and script was failing before itself.
This fixed my issue:
- deleted my node_modules.
- npm cache clean
- opened cmd as administrator at the repository folder
- logged-in to the https://registry.npmjs.org/ using username and passoward as few of my components needed authentication to install.
- npm i
If you ever get this error, the hotfix is to follow these steps:
delete node-modules folder
run command npm cache clean --force
run command npm install
install the package again with npm install your-package-name
Actually the current package you are installing has some dependencies which is not being found my npm. So, before installing this package just perform the following command. (It will install all your listed dependencies mentioned in package.json file which are necesaary to run your application)
npm install
It works...!
For not to delete package-lock.json or node_modules every time, just add file ".npmrc" with content "package-lock=false", or add this string if file ".npmrc" already exists.
You can try by removing the package-lock.json with the command rm package-lock.json then you go to the Node.JS website you 'install it' by going to LTS then after your node is updated run npm install in your terminal and that worked for me.
Just update the node to the latest version.
It solved my problem.
I was running command in Ubuntu wsl and it wasn't working so i tried running in cmd prompt and it worked
Kindly check any package.json is open anywhere, then close it first then retry.
For me I just deleted both package-lock.json & node_modules folder. Now everything works great 😃
Another thing I've seen a lot on projects that have been around and gone through multiple contributors:
Double check to see if anyone on your team has simultaneously done a npm install and yarn.
The tell-tale sign is you'll see a package-lock.json (generated by npm) and yarn-lock.json (generated by yarn) in the same repo. This can cause side-effects from collisions in the node_modules folder.
You can try dumping that folder locally, establishing a package manager of choice for your project and instructing the whole team on best practices.
For me I had to sudo the npm install command. Don't know why... Don't want to know either.
sudo npm install --save-dev my_package
These steps work for me:
1. run "npm cache verify" or
2. remove node_modules and package-lock.json
and rerun command)
Sometimes it can be the fault of the package you are trying to install. If that package is a local package and has a node_modules folder. Try:
cd /path/to/package
rm -rf package-lock.json npm-shrinkwrap
npm install
Happen to me when I was coding react native app with expo,
when I was run the app and try to install form npm happen that error.
So just stop run the app and reinstall the package
for me it work fine
Updating npm to latest version worked for me.
A combination of the answers from above worked for me:
Restart the computer ( in my case WSL );
Run the commands from bellow from your chosen terminal, not from VSCode terminal
npm cache clean -f
rm -rf node_modules
rm package-lock.json
npm install
Good luck! :) ✌
Dont run cmd in root of a directory.
there might be one directory inside which u try to run.
cd Directory
npm i
In may case, it was next-i18next.config.js,
that had duplicated languages in the locales value,
and fallbackLng with existing languages refer to existing languages.
This works for me,
rm -rf ./**/node_modules
while I need lerna bootstrap
This worked for me (on command line in Ubuntu):
Update Node using
sudo npm install -g n
followed by
sudo n 16.13.2
Closed and reopened shell, cd back into the correct repo and then
sudo install npm -g
Deleting package-lock.json or node_modules & After running:
npm install -g npm
it is working for me.

Failure to install packages after setting yarn to package manager

Im trying to setup a new project with angular cli and have set my package manger like this:
ng set --global packageManager=yarn
However, when I try to create a new angular project with cli, I get this
Installing packages for tooling via yarn.
'yarn' is not recognized as an internal or external command,
operable program or batch file.
Package install failed, see above.
Package install failed, see above.
So then I start looking to see if I have yarn even installed and I do this:
D:\devsrc>npm list -g --depth=0
and get this:
C:\Users\me\AppData\Roaming\npm
+-- #angular/cli#1.3.1
+-- angular-cli#1.0.0-beta.28.3
`-- typescript#2.2.2
npm ERR! peer dep missing: rxjs#^5.0.1, required by #angular/core#2.4.10
npm ERR! extraneous: tsickle#0.2.5 C:\Users\
How can I have 2 different versions of angular cli installed?
How can I clean this up and get Yarn installed?
So first thing, you are getting 'yarn' is not recognized as an internal or external command error is because you do not have yarn globally installed run
npm install yarn -g to fix that
Second you have two #angular/cli#1.3.1 and angular-cli#1.0.0-beta.28.3 packages is because the angular cli package name has being changed since version 1.0.0-beta.28.3. Before it was angular-cli now it is #angular/cli so just uninstall the old one uninstall angular-cli -g. After that you might need to reinstall the latest one npm install #angular/cli -g