Open JustOneJance opened 5 years ago
Duplicate of #2821
Not sure if this will be helpful, but that output comes from this shell script https://github.com/yarnpkg/yarn/blob/master/bin/yarn#L31
specifically it uses command -v node
and command -v nodejs
so you could make sure that that command
knows where to find node.
as example output, on OSX using nvm
I get:
~/Projects/yarn-test2 🐒 command -v node
/Users/jvalore/.nvm/versions/node/v8.10.0/bin/node
Не уверен, что это будет полезно, но этот вывод получен из этого сценария оболочки https://github.com/yarnpkg/yarn/blob/master/bin/yarn#L31
в частности, он использует,
command -v node
иcommand -v nodejs
поэтому вы можете убедиться, что онcommand
знает, где найти узел.В качестве примера вывода на OSX с использованием
nvm
я получаю:~/Projects/yarn-test2 🐒 command -v node /Users/jvalore/.nvm/versions/node/v8.10.0/bin/node
/home/dev/.nvm/versions/node/v12.14.0/bin/node
mi error: Yarn requires Node.js 4.0 or higher to be installed.
Here I got this error because my .zshrc file was configured to set Yarn in PATH before configuring NVM. To fix this, I changed the line export PATH="$(yarn global bin):$PATH
to stay after the NVM/NPM settings.
@JustOneJance I have similar problem and how I can investigated it related with husky. When I'm trying to commit from Webstorm it shows me error Yarn requires Node.js 4.0 or higher to be installed.
but commit form terminal works Ok.
For me I found the solution:
create file ~/.huskyrc
with the following content
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
as it described here https://github.com/typicode/husky#node-version-managers
For me I found the solution: create file
~/.huskyrc
with the following contentexport NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
as it described here https://github.com/typicode/husky#node-version-managers
September 2021 update on @peakercope: Solution is still working but the reference link has changed to https://typicode.github.io/husky/#/?id=command-not-found
Note that the file must be in your user's home directory ~
(not in the repository)
i use Ubuntu
I have nvm:
nvm ls v8.11.3 v8.11.4 -> v11.1.0 default -> 8.11.4 (-> v8.11.4) node -> stable (-> v11.1.0) (default) stable -> 11.1 (-> v11.1.0) (default) I installed yarn with:
sudo apt-get install --no-install-recommends yarn I also added in .bashrc alias node=nodejs. But when I try yarn install I see:
Yarn requires Node.js 4.0 or higher to be installed. How can I fix it? it happend only in my project. Which i download from gitlub. package.json "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "preinstall": "sudo yarn global add prettifier eslint flow-bin", "babel": "babel", "dev": "webpack-dev-server", "lint": "eslint", "validate": "yarn list", "prettify": "./node_modules/prettifier/bin/prettifier.js", "precommit": "lint-staged", "fmt": "prettier --write './*/.js'" }, "devDependencies": { "@babel/cli": "^7.1.5", "@babel/core": "^7.1.2", "@babel/node": "^7.0.0", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/preset-env": "^7.1.0", "@babel/preset-flow": "^7.0.0", "@webpack-contrib/config-loader": "^1.2.1", "autoprefixer": "^9.3.1", "babel-cli": "^6.26.0", "babel-eslint": "^10.0.1", "babel-loader": "^8.0.4", "babel-preset-react": "^6.24.1", "css-loader": "^1.0.1", "eslint": "^5.8.0", "eslint-config-airbnb": "^17.1.0", "eslint-plugin-flowtype": "^3.2.0", "eslint-plugin-import": "^2.14.0", "eslint-plugin-jsx-a11y": "^6.1.2", "eslint-plugin-react": "^7.11.1", "flow-typed": "^2.5.1", "husky": "^1.1.3", "lint-staged": "^8.0.4", "mini-css-extract-plugin": "^0.4.4", "node-sass": "^4.10.0", "postcss-loader": "^3.0.0", "precommit-hook": "^3.0.0", "prettier": "^1.15.2", "react": "^16.6.0", "react-dom": "^16.6.0", "react-hot-loader": "^4.3.12", "sass-loader": "^7.1.0", "style-loader": "^0.23.1", "webpack": "^4.25.1", "webpack-cli": "^3.1.2", "webpack-dev-server": "^3.1.10" }, "dependencies": { "babel-preset-flow": "^6.23.0", "flow-bin": "^0.85.0", "uglifyjs-webpack-plugin": "^2.0.1" }, "pre-commit": [ "lint", "validate", "flow check" ], "lint-staged": { "*.js": [ "prettier --write", "git add" ] },