Не удается установить node-sass для проекта React

#javascript #node.js #reactjs #npm

#javascript #node.js #reactjs #npm

Вопрос:

Я хочу добавить node-sass в свои проекты react. Это что-то Pyhton ошибка. Как я могу это исправить? Я пытался обновить или понизить node, но не знал, какая версия подходит. Кроме того, пытался переустановить node-gyp , но все еще не работает. В чем проблема с этим?

node-версия : 14.15.0
версия npm: 6.14.8

     error C:UsershasanDesktopmodabu-reactnode_modulesnode-sass: Command failed.
    Exit code: 1
    Command: node scripts/build.js
    Arguments:
    Directory: C:UsershasanDesktopmodabu-reactnode_modulesnode-sass
    Output:
    Building: C:Program Filesnodejsnode.exe C:UsershasanDesktopmodabu-reactnode_modulesnode-gypbinnode-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
    gyp info it worked if it ends with ok
    gyp verb cli [
    gyp verb cli   'C:\Program Files\nodejs\node.exe',
    gyp verb cli   'C:\Users\hasan\Desktop\modabu-react\node_modules\node-gyp\bin\node-gyp.js',
    gyp verb cli   'rebuild',
    gyp verb cli   '--verbose',
    gyp verb cli   '--libsass_ext=',
    gyp verb cli   '--libsass_cflags=',
    gyp verb cli   '--libsass_ldflags=',
    gyp verb cli   '--libsass_library='
    gyp verb cli ]
    gyp info using node-gyp@7.1.2
    gyp info using node@14.15.0 | win32 | x64
    gyp verb command rebuild []
    gyp verb command clean []
    gyp verb clean removing "build" directory
    gyp verb command configure []
    gyp verb find Python Python is not set from command line or npm configuration
    gyp verb find Python Python is not set from environment variable PYTHON
    gyp verb find Python checking if "python3" can be used
    gyp verb find Python - executing "python3" to get executable path
    gyp verb find Python - "python3" is not in PATH or produced an error
    gyp verb find Python checking if "python" can be used
    gyp verb find Python - executing "python" to get executable path
    gyp verb find Python - "python" is not in PATH or produced an error
    gyp verb find Python checking if "python2" can be used
    gyp verb find Python - executing "python2" to get executable path
    gyp verb find Python - "python2" is not in PATH or produced an error
    gyp verb find Python checking if Python is C:Python37python.exe
    gyp verb find Python - executing "C:Python37python.exe" to get version
    gyp verb find Python - "C:Python37python.exe" could not be run
    gyp verb find Python checking if Python is C:Python27python.exe
    gyp verb find Python - executing "C:Python27python.exe" to get version
    gyp verb find Python - "C:Python27python.exe" could not be run
    gyp verb find Python checking if the py launcher can be used to find Python
    gyp verb find Python - executing "py.exe" to get Python executable path
    gyp verb find Python - "py.exe" is not in PATH or produced an error
    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 checking if "python2" can be used
    gyp ERR! find Python - "python2" is not in PATH or produced an error
    gyp ERR! find Python checking if Python is C:Python37python.exe
    gyp ERR! find Python - "C:Python37python.exe" could not be run
    gyp ERR! find Python checking if Python is C:Python27python.exe
    gyp ERR! find Python - "C:Python27python.exe" could not be run
    gyp ERR! find Python checking if the py launcher can be used to find Python
    gyp ERR! find Python - "py.exe" 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="C:PathTopython.exe"
    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 "C:PathTopython.exe"
    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 (C:UsershasanDesktopmodabu-reactnode_modulesnode-gyplibfind-python.js:302:47)
    gyp ERR! stack     at PythonFinder.runChecks (C:UsershasanDesktopmodabu-reactnode_modulesnode-gyplibfind-python.js:136:21)
    gyp ERR! stack     at PythonFinder.<anonymous> (C:UsershasanDesktopmodabu-reactnode_modulesnode-gyplibfind-python.js:200:18)       
    gyp ERR! stack     at PythonFinder.execFileCallback (C:UsershasanDesktopmodabu-reactnode_modulesnode-gyplibfind-python.js:266:16)  
    gyp ERR! stack     at exithandler (child_process.js:315:5)
    gyp ERR! stack     at ChildProcess.errorhandler (child_process.js:327:5)
    gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
    gyp ERR! stack     at onErrorNT (internal/child_process.js:465:16)
    gyp ERR! stack     at processTicksAndRejections (internal/process/task_queues.js:80:21)
    gyp ERR! System Windows_NT 10.0.19041
    gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\hasan\Desktop\modabu-react\node_modules\node-gyp\bin\node-gyp.js" 
    "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
    gyp ERR! cwd C:UsershasanDesktopmodabu-reactnode_modulesnode-sass
    gyp ERR! node -v v14.15.0
  

Комментарии:

1. Ошибка довольно ясна: Error: Could not find any Python installation to use . Вы установили Python2 или Python3 на этом компьютере? Если нет: python.org/downloads

2. Привет @ChrisG мне нужно установить последнюю версию?

3. Да, лучше всего использовать последнюю версию Python 3. При его установке двоичное местоположение должно быть добавлено к PATH, что означает, что в командной строке вы должны иметь возможность просто ввести python --version и просмотреть установленную версию. Как только это сработает, попробуйте снова установить модули узла.

4. @ChrisG `gyp ОШИБКА! Ошибка стека: не удалось найти какую-либо установку Visual Studio для использования gyp ERR! стек в VisualStudioFinder. сбой (C:UsershasanDesktopmodabu-reactnode_modulesnode-gyplibfind-visualstudio.js:121:47 ) джип ОШИБАЕТСЯ! стек в C:UsershasanDesktopmodabu-reactnode_modulesnode-gyplibfind-visualstudio.js:74:16 джип, ОШИБАЕШЬСЯ! стек в VisualStudioFinder.findVisualStudio2013 (C:UsershasanDesktopmodabu-reactnode_modulesnode-gyplibfind-visualstudio.js:351:14 ) джип ОШИБАЕТСЯ! стек в C:UsershasanDesktopmodabu-reactnode_modulesnode-

5. Хорошо … найдите в Google основное сообщение об ошибке и найдите существующие решения