Я не могу установить какие-либо пакеты npm, так как получаю следующую ошибку на своем M1 Mac mini
npm WARN deprecated @types/[email protected]: This is a stub types definition. anymatch provides its own type definitions, so you do not need this installed.
npm WARN deprecated @types/[email protected]: This is a stub types definition. browserslist provides its own type definitions, so you do not need this installed.
npm WARN deprecated [email protected]: No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option.
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated [email protected]: flatten is deprecated in favor of utility frameworks such as lodash.
npm WARN deprecated @stylelint/[email protected]: Use the original unforked package instead: postcss-markdown
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: Deprecated due to CVE-2021-21366 resolved in 0.5.0
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: This package is unmaintained and deprecated. See the GH Issue 259.
npm WARN deprecated [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated [email protected]: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated [email protected]: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated [email protected]: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path /Users/vr/Desktop/code/ch_v3_final/node_modules/deasync
npm ERR! command failed
npm ERR! command sh -c node ./build.js
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
npm ERR! gyp ERR! stack at PythonFinder.failNoPython (/Users/vr/Desktop/code/ch_v3_final/node_modules/node-gyp/lib/configure.js:484:19)
npm ERR! gyp ERR! stack at PythonFinder.<anonymous> (/Users/vr/Desktop/code/ch_v3_final/node_modules/node-gyp/lib/configure.js:406:16)
npm ERR! gyp ERR! stack at F (/Users/vr/Desktop/code/ch_v3_final/node_modules/node-gyp/node_modules/which/which.js:68:16)
npm ERR! gyp ERR! stack at E (/Users/vr/Desktop/code/ch_v3_final/node_modules/node-gyp/node_modules/which/which.js:80:29)
npm ERR! gyp ERR! stack at /Users/vr/Desktop/code/ch_v3_final/node_modules/node-gyp/node_modules/which/which.js:89:16
npm ERR! gyp ERR! stack at /Users/vr/Desktop/code/ch_v3_final/node_modules/isexe/index.js:42:5
npm ERR! gyp ERR! stack at /Users/vr/Desktop/code/ch_v3_final/node_modules/isexe/mode.js:8:5
npm ERR! gyp ERR! stack at FSReqCallback.oncomplete (node:fs:198:21)
npm ERR! gyp ERR! System Darwin 21.4.0
npm ERR! gyp ERR! command "/Users/vr/.nvm/versions/node/v16.14.2/bin/node" "/Users/vr/Desktop/code/ch_v3_final/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/vr/Desktop/code/ch_v3_final/node_modules/deasync
npm ERR! gyp ERR! node -v v16.14.2
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/vr/.npm/_logs/2022-03-23T03_16_33_423Z-debug-0.log
Я понимаю, что python не установлен, поэтому я попытался запустить команду python
python
zsh: command not found: python
Однако, когда я запускаю python3, он отлично работает Я установил python3 с помощью pyenv, который был установлен с помощью доморощенного
Я так понимаю путь не добавлен, вот так выглядит мой файл ~/.zshrc
export NVM_DIR = "$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion
source ~/.nvm/nvm.sh
export PYENV_ROOT = "$HOME/.pyenv"
export PATH = "$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
Как заставить команду python работать? Потратил почти 12 часов и еще не решил это.
Что я пробовал
brew install python@2
Это говорит
Warning: No available formula with the name "python@2". Did you mean ipython, bpython, jython or cython?
==> Searching for similarly named formulae...
These similarly named formulae were found:
ipython bpython jython cython
To install one of them, run (for example):
brew install ipython
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
ОБНОВЛЕНИЕ 1 Я сделал то, что написал @ElapsedSoul в комментариях, но теперь выдает новую ошибку. это должно быть ошибка, несовместимая с Python 2. К сожалению, выполнение brew install python@2 тоже не работает, что делать?
npm WARN deprecated @types/[email protected]: This is a stub types definition. anymatch provides its own type definitions, so you do not need this installed.
npm WARN deprecated @types/[email protected]: This is a stub types definition. browserslist provides its own type definitions, so you do not need this installed.
npm WARN deprecated [email protected]: No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option.
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated [email protected]: flatten is deprecated in favor of utility frameworks such as lodash.
npm WARN deprecated @stylelint/[email protected]: Use the original unforked package instead: postcss-markdown
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: Deprecated due to CVE-2021-21366 resolved in 0.5.0
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: This package is unmaintained and deprecated. See the GH Issue 259.
npm WARN deprecated [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated [email protected]: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated [email protected]: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated [email protected]: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path /Users/vr/Desktop/code/ch_v3_final/node_modules/deasync
npm ERR! command failed
npm ERR! command sh -c node ./build.js
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: /usr/local/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "<string>", line 1
npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack ^
npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:399:12)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:526:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1092:16)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm ERR! gyp ERR! System Darwin 21.4.0
npm ERR! gyp ERR! command "/Users/vr/.nvm/versions/node/v16.14.2/bin/node" "/Users/vr/Desktop/code/ch_v3_final/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/vr/Desktop/code/ch_v3_final/node_modules/deasync
npm ERR! gyp ERR! node -v v16.14.2
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/vr/.npm/_logs/2022-03-23T09_28_32_986Z-debug-0.log
вы можете использовать ln -s /usr/local/bin/python3 /usr/local/bin/python
и добавить /usr/local/bin
к $PATH
@ElapsedSoul, команда python теперь работает, но по-прежнему выдает ошибку при установке npm, я обновил вопрос
import sys; print "%s.%s.%s"
Это старая добрая нотация Python 2, если я когда-либо видел :)
Как упоминалось в @ElapsedSoul. macOS 12.3 удалила Python 2, который шел по умолчанию все эти годы. Поэтому я бы лично рекомендовал другим не обновляться до 12.3, если вам нужен Python 2, пока вы не найдете альтернативное решение.
Некоторые возможные альтернативы включают следующее:
Homebrew, к сожалению, давно избавился от Python 2. Однако есть несколько обходных путей, чтобы попытаться заставить его работать: Как переустановить python@2 из Homebrew?.
Я не проверял это, так что это может не сработать. Но если это так, это, вероятно, лучшее решение для ваших нужд. От следующее:
brew install pyenv
pyenv install 2.7.18
pyenv global 2.7.18
Например, для MacPorts все еще доступен Python 2. Это также добавит его в PATH:
sudo port install python27
Я уверен, что есть другие менеджеры пакетов macOS, которые также предоставляют Python 2.7.
мне удалось найти причину ошибки, мой проект использовал node-sass, и он полностью устарел, я заменил его на sass, и теперь он работает
Ха, однажды я просыпаюсь и удивляюсь, где мой питон? А потом я обнаружил, что пропустил python2, но python3 в порядке. Какой ужасный UX!
python2 не применяется в MacOS 12.3