Environment: Windows, Node 16.18.0, Corepack 0.14.1
I am following these instructions to install Yarn.
When I run corepack prepare yarn#3.2.4 or corepack prepare yarn#3.2.4 --activate
I get the following error:
Preparing yarn#3.2.4... Internal Error: ENOENT: no such file or directory, stat 'C:\Users\rashiditaba\AppData\Local\node\corepack\yarn\3.2.4' Error: ENOENT: no such file or directory, stat 'C:\Users\***\AppData\Local\node\corepack\yarn\3.2.4'
Hello I experienced the same problem. Corepack is an experimental tool to help with managing versions of your package managers. Due to its experimental status, Corepack currently needs to be explicitly enabled to have any effect.
Disable Corepack with the command:
corepack disable
You will now be able to install yarn via npm:
npm install -g yarn --force
To check the installed version of yarn use:
yarn -v
To upgrade the version use (stable version 3.2.4):
yarn set version stable
Now you can enable corepack again (if it fails keep it disabled):
corepack enable
Try the failed command:
corepack prepare yarn#3.2.4 --activate
I leave you the link with the description of the solution:
https://nodejs.org/dist/latest/docs/api/corepack.html
I hope it helps you
From the error your getting it seems like you have to wrong directory PATH to yarn. Find the directory where yarn is installed and update it's PATH in the environment variables.
Related
I have a work project that is configured using yarn. I've used npm commands on other projects for the company, but for this project, I need to use yarn. The reason that I haven't used yarn before is because whenever I run any yarn commands locally, I get the following error:
TypeError: Invalid number of spaces
at tokenise (/usr/local/lib/node_modules/yarn/lib/cli.js:63358:17)
at tokenise.next (<anonymous>)
I'm on a mac and have tried running yarn, brew install yarn,npm install --global yarn and curl --compressed -o- -L https://yarnpkg.com/install.sh | bash. I've also tried npm uninstall yarnand brew uninstall yarn to try to start fresh, but after each attempt at removing and reinstalling, I get the same error.
The cloned repository that I'm working with includes a .yarnrc file and a yarn.lock file. Also, I'm on a work vpn, and have to install dependencies over the vpn, so I have a mirror registry in my .yarnrc file.
Any suggestions on where to start troubleshooting? Obviously, I'm doing something wrong here.
I'm trying to install some npm packages globally in google cloud platform each time the shell started.
I added these commands in $HOME/.customize_environment file.
#!/bin/sh
date -u
npm i -g #angular/cli
then, I open the file /var/log/customize_environment to see the log output from $HOME/.customize_environment
I found it executed and the date is displayed (the first line)
but npm couldn't installed with this error npm command not found
npm commands are available after the cloud shell starts, so I guess the file $HOME/.customize_environment is executed before installing node.
I tried to use the full path: /usr/local/nvm/versions/node/v12.14.1/bin/npm i -g #angular/cli, but I got this error
/usr/bin/env: ‘node’: No such file or directory
is there a way to automatically install npm packages globally?
The path env var isn't set or active. Use the full path of NPM location like that
/usr/local/nvm/versions/node/v12.14.1/bin/npm i -g #angular/cli
Be careful. if Cloud Shell update the version of NPM the path will change.
You can also try to add your NPM (without full path) command at the end of the ~/.bashrc file.
I have a node project and I am creating a gitlab pipeline for that.
To check outdated packages I am running npm-check in the script part but its showing npm-check not found.
When I install it with npm install npm-check then also I get the same error. But when installing it with the -g option its showing permission denied.
install_dependencies:
stage: build
script:
- npm install -g npm-check
- npm-check # Check Outdated Package
Can anyone help me to run npm-check in my gitlab pipeline.
I don't have to rights to install it globally. But it should not be not found if you install it locally first.
Remove the -g and make sure you are in the folder where you installed your node_modules.
Then you can run npx npm-check or ./node_modules/.bin/npm-check.
Note that you can't directly execute npm-check since the binary is not in the current folder but under node_modules/.bin/
I am trying to install the aws-cdk and in the terminal and I run the npm install -g aws-cdk. As stated here After npm runs, I get:
/usr/local/Cellar/node/9.8.0/bin/cdk -> /usr/local/Cellar/node/9.8.0/lib/node_modules/aws-cdk/bin/cdk
+ aws-cdk#0.31.0
updated 1 package in 1.636s
If I try to run cdk I get:
zsh: command not found: cdk
Installing as root worked for me:
sudo npm install -g aws-cdk
Make sure /usr/local/Cellar/node/9.8.0/bin is in your PATH
In my case, I added this to the end of my .bash_profile:
export PATH=$PATH:$(npm get prefix)/bin.
I did that based on information from a different thread.
If you're using nvm to manage your node versions, make sure that the CDK package is being installed in the same version of node you're currently using or the version you want to use.
The OP noted their CDK was getting installed in node/9.8.0:
Check the current node version running: nvm current.
If you see that the CDK installation location is different than the node version indicated by nvm current, you'll need to switch your node version using:
nvm use <node-version-where-cdk-is-installed>
In the OP's case, this would be nvm use 9.8.0.
What worked for me in mac was adding to the path the bin directory of globally installed node modules.
Install aws-cdk by:
npm install -g aws-cdk
Try to run it
cdk
no command found error
make or edit your .zshrc file in your user directory
add line to .zshrc with export PATH=$PATH:/{your_user_path}/.npm-global/bin
execute it source .zshrc
now cdk should work
Pay attention that it is mac based approach.
I get this error message when I try installing feathers from npm
npm WARN deprecated nomnom#1.8.1: Package no longer supported. Contact support#npmjs.com for more info.
npm WARN deprecated babel-preset-es2015#6.24.1: 🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
Help!!
As Vasan pointed out in the comments, running
npm install -g #feathersjs/cli
from the command prompt on Windows installs a file feathers.cmd in the folder:
%APPDATA%\npm
If this folder is not on your PATH, then feathers will not be recognised as an executable - it appears that the global install doesn't add it to the path automatically.
Editing system environment variables to add this folder to your path should make the feathers cli tools available.
Note that after altering your path you may need to restart your terminal for the updated path to be available.
Its very simple, if you have an earlier version installed, uninstall the old feathers-cli using:
npm uninstall feathers-cli -g
Then install #feathersjs/cli and upgrade a project by the following commands:
npm install #feathersjs/cli -g
cd path/to/project
feathers upgrade
I also faced with the installation issue. But got an error: 404 Not Found: babel-messages#^6.23.0. I've solved it when run npm install #feathersjs/cli -g through the windows terminal (cmd). Before that I was running it on bash.
This issue also occurs when installation is ran using Admin credential(Windows 10), reinstall without elevated cmd/powershell credential also solved the problem.