简体   繁体   English

Nuxt:我有构建错误,我不明白为什么

[英]Nuxt : i have build error that i can't understand why

i want to build Nuxt on node server(Centos ) and i have this error on build.我想在节点服务器(Centos)上构建 Nuxt,并且在构建时出现此错误。

[4/4] Building fresh packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
error /usr/src/nuxt-app/connector/node_modules/fibers: Command failed.
Exit code: 1
Command: node build.js || nodejs build.js
Arguments:
Directory: /usr/src/nuxt-app/connector/node_modules/fibers
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@8.3.0
gyp info using node@16.13.1 | linux | x64
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47)
gyp ERR! stack     at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:202:16)
gyp ERR! stack     at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:294:16)
gyp ERR! stack     at exithandler (node:child_process:404:5)
gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:416:5)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
gyp ERR! stack     at onErrorNT (node:internal/child_process:477:16)
gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
gyp ERR! System Linux 4.18.0-348.7.1.el8_5.x86_64
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /usr/src/nuxt-app/connector/node_modules/fibers
gyp ERR! node -v v16.13.1
gyp ERR! node-gyp -v v8.3.0
gyp ERR! not ok
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: `sudo apt-get install g++ build-essential`
RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'`
Alpine users please run: `sudo apk add python make g++`
gyp info it worked if it ends with ok
gyp info using node-gyp@8.3.0
gyp info using node@16.13.1 | linux | x64
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47)
gyp ERR! stack     at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:202:16)
gyp ERR! stack     at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:294:16)
gyp ERR! stack     at exithandler (node:child_process:404:5)
gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:416:5)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
gyp ERR! stack     at onErrorNT (node:internal/child_process:477:16)
gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
gyp ERR! System Linux 4.18.0-348.7.1.el8_5.x86_64
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /usr/src/nuxt-app/connector/node_modules/fibers
gyp ERR! node -v v16.13.1
gyp ERR! node-gyp -v v8.3.0
gyp ERR! not ok
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: `sudo apt-get install g++ build-essential`
RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'`
Alpine users please run: `sudo apk add python make g++`
The command '/bin/sh -c yarn install' returned a non-zero code: 1

stack doesn't allow me to add because of long code and i had to add some text here stack doesn't allow me to add because of long code and i had to add some text here stack doesn't allow me to add because of long code and i had to add some text here由于代码长,堆栈不允许我添加,我必须在此处添加一些文本 由于长代码,堆栈不允许我添加,我必须在此处添加一些文本 堆栈不允许我添加,因为长代码,我不得不在这里添加一些文字

As mentioned by the comments you need to install python, you say you have installed python but the main problem is that it need's to be in your path variable.正如评论中提到的,您需要安装 python,您说您已经安装了 python,但主要问题是它需要在您的路径变量中。

I have never used centOS so if some of the below commands aren't found or not working you can search for equivalents.我从未使用过 centOS,因此如果找不到以下某些命令或无法正常工作,您可以搜索等效命令。

Run to see if either of the following commands give a path as output:运行以查看以下任一命令是否给出了 output 的路径:

which python
which python3

Make sure the output doesn't have doesn't have something like no x in (path)确保 output 没有 没有类似 no x in (path)

Since you say installation didn't fix your issue I am assuming it wasn't added to your path and so the above commands didn't give the expected output.既然你说安装没有解决你的问题,我假设它没有添加到你的路径中,所以上面的命令没有给出预期的 output。

All you need to do now is add python to your path:您现在需要做的就是将 python 添加到您的路径中:

echo "export PATH=\$PATH:/usr/bin/python" >> ~/.bashrc

or change the path depending on where it's installed或根据安装位置更改路径

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM