nodeenv icon indicating copy to clipboard operation
nodeenv copied to clipboard

MacOS Monterey 12.3 deletes Python2 hence nodeenv fails

Open slimandslam opened this issue 2 years ago • 3 comments

Just as the subject line says:

$ python
-bash: python: command not found
$ nodeenv
env: python: No such file or directory
$

Of course, python3 exists. But.....

$ sudo ln -s /usr/bin/python3 /usr/bin/python
Password:
ln: /usr/bin/python: Operation not permitted
$

I guess you have to disable SIP to make this symlink: https://developer.apple.com/documentation/security/disabling_and_enabling_system_integrity_protection

I guess the question is: does nodeenv work properly with python 3 ?

Clarification: MacOS 12.3 deletes Python2 and /usr/bin/python (which breaks anything with #!/usr/bin/python in it)

slimandslam avatar Mar 23 '22 17:03 slimandslam

I've been using a patched version of nodeenv locally that uses python3 in the shebang (exactly like https://github.com/ekalinin/nodeenv/pull/305) and haven't seen any issues.

maxmelamed avatar Apr 21 '22 19:04 maxmelamed

Yeah, I believe this patch is working well for the systems where python3 is installed. But at the same time I think it will break ones where python3 is not installed.

ekalinin avatar Apr 21 '22 19:04 ekalinin

Yeah, I believe this patch is working well for the systems where python3 is installed. But at the same time I think it will break ones where python3 is not installed.

Right, definitely don't want to break any existing users. If the python_requires gets updated accordingly in setup.py though, easy_install and pip install would know that the newer versions are incompatible with py2 and wouldn't update unless users are on python3 already (this would prevent them from getting future updates unless they install python3, however).

maxmelamed avatar Apr 21 '22 20:04 maxmelamed