首页 > 解决方案 > scratch-blocks@0.1.0 预发布:`python build.py && webpack`

问题描述

我在 linux 终端运行暂存块

https://scratch.mit.edu/discuss/topic/289503/

我遇到的问题是

python build.py && webpack

scratch-blocks@0.1.0 预发布:python build.py && webpack

你能帮帮我吗?

npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.

> scratch-blocks@0.1.0 prepublish /mnt/e/hit and try/scratch/scratch-blocks
> python build.py && webpack

Traceback (most recent call last):
File "build.py", line 39, in <module>
  raise Exception("Blockly build only compatible with Python 2.x.\n"
Exception: Blockly build only compatible with Python 2.x.
You are using: 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0]
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scratch-blocks@0.1.0 prepublish: `python build.py && webpack`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scratch-blocks@0.1.0 prepublish script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/soumitya/.npm/_logs/2020-11-05T05_06_36_269Z-debug.log

标签: javascriptpythonnode.jsreactjsnpm

解决方案


当我将 python2 设置为默认值时,它可以工作:

通过添加以下内容为 Linux 终端中的默认 python 设置优先级:

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1

在这里,我们将python3优先级设置为 10 和python2优先级 1。这将成为python3默认的 python。如果您希望 Python2 作为默认值,则将 python2 的优先级设置为高于 python3


推荐阅读