Node.js 코드베이스에 들어가기 위해 NPM을 통해 몇 가지 종속성, 즉 jQuery를 다운로드해야합니다.
을 실행하려고하면 npm install jquery
이 오류가 계속 발생합니다.
Your environment has been set up for using Node.js 0.8.21 (x64) and NPM
C:\Users\Matt Cashatt>npm install jquery
npm http GET https://registry.npmjs.org/jquery
npm http 304 https://registry.npmjs.org/jquery
npm http GET https://registry.npmjs.org/jsdom
npm http GET https://registry.npmjs.org/xmlhttprequest
npm http GET https://registry.npmjs.org/htmlparser/1.7.6
npm http GET https://registry.npmjs.org/location/0.0.1
npm http GET https://registry.npmjs.org/navigator
npm http GET https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/htmlparser/1.7.6
npm http 304 https://registry.npmjs.org/xmlhttprequest
npm http 304 https://registry.npmjs.org/location/0.0.1
npm http 304 https://registry.npmjs.org/navigator
npm http 304 https://registry.npmjs.org/jsdom
npm http 304 https://registry.npmjs.org/contextify
npm http GET https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/cssom
npm http GET https://registry.npmjs.org/cssstyle
npm http GET https://registry.npmjs.org/request
npm http 304 https://registry.npmjs.org/bindings
> contextify@0.1.4 install C:\Users\Matt Cashatt\node_modules\jquery\node_module
s\contextify
> node-gyp rebuild
C:\Users\Matt Cashatt\node_modules\jquery\node_modules\contextify>node "C:\Progr
am Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\b
in\node-gyp.js" rebuild
npm http 304 https://registry.npmjs.org/cssstyle
npm http 304 https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/request
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\nod
e_modules\node-gyp\lib\configure.js:113:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node
-gyp\lib\configure.js:82:11
gyp ERR! stack at Object.oncomplete (fs.js:297:15)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu
les\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Matt Cashatt\node_modules\jquery\node_modules\contextify
gyp ERR! node -v v0.8.21
gyp ERR! node-gyp -v v0.8.4
gyp ERR! not ok
npm ERR! error rolling back Error: ENOTEMPTY, rmdir 'C:\Users\Matt Cashatt\node_
modules\jquery\node_modules\jsdom\node_modules\request\tests'
npm ERR! error rolling back jquery@1.8.3 { [Error: ENOTEMPTY, rmdir 'C:\Users\M
att Cashatt\node_modules\jquery\node_modules\jsdom\node_modules\request\tests']
npm ERR! error rolling back errno: 53,
npm ERR! error rolling back code: 'ENOTEMPTY',
npm ERR! error rolling back path: 'C:\\Users\\Matt Cashatt\\node_modules\\jque
ry\\node_modules\\jsdom\\node_modules\\request\\tests' }
npm ERR! contextify@0.1.4 install: `node-gyp rebuild`
npm ERR! `cmd "/c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the contextify@0.1.4 install script.
npm ERR! This is most likely a problem with the contextify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls contextify
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "jquery"
npm ERR! cwd C:\Users\Matt Cashatt
npm ERR! node -v v0.8.21
npm ERR! npm -v 1.2.11
npm ERR! code ELIFECYCLE
npm ERR! Error: ENOENT, lstat 'C:\Users\Matt Cashatt\node_modules\jquery\node_mo
dules\jsdom\node_modules\request\tests\test-pipes.js'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "jquery"
npm ERR! cwd C:\Users\Matt Cashatt
npm ERR! node -v v0.8.21
npm ERR! npm -v 1.2.11
npm ERR! path C:\Users\Matt Cashatt\node_modules\jquery\node_modules\jsdom\node_
modules\request\tests\test-pipes.js
npm ERR! fstream_path C:\Users\Matt Cashatt\node_modules\jquery\node_modules\jsd
om\node_modules\request\tests\test-pipes.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack C:\Program Files\nodejs\node_modules\npm\node_modules\fst
ream\lib\writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:297:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\Matt Cashatt\npm-debug.log
npm ERR! not ok code 0
C:\Users\Matt Cashatt>
실패한 Python 설치로 인한 것 같습니다. 글쎄, 파이썬을 설치하고 변수를 설정 한 다음 재부팅했지만 여전히 오류가 발생했습니다.
내가 잃어버린 것에 대한 단서가 있습니까?
답변
문제는 환경 변수를 설정 하지 않았다는 것 입니다.
오류는 분명히 이것을 말합니다 :
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
그리고 당신의 의견에서, 당신은 이것을했다고 말합니다 :
set PYTHONPATH=%PYTHONPATH%;C:\My_python_lib
훌륭하지만 PYTHON
변수를 설정하지 않고 변수를 설정합니다 PYTHONPATH
.
한편, set
명령을 사용 하면 현재 cmd
세션 에만 영향을줍니다 . 그 후에 재부팅하면, 말했듯 cmd
이 변수가 설정되어 있지 않은 완전히 새로운 세션으로 끝납니다 .
환경 변수를 영구적으로 설정하는 방법은 몇 가지가 있습니다. XP의 시스템 제어판에서 가장 쉬운 방법은 Vista와 7에서 다시, 8에서 다시 다르지만 Google에서는 가능합니다.
또는 그 사이에서 재부팅하지 않고 명령 set
바로 전에 수행하십시오 npm
.
설정 스크립트가하려고하는 것과 똑같은 일을 수행하여 올바르게 수행했는지 테스트 할 수 있습니다 : 실행하기 전에 실행 npm
해보십시오 %PYTHON%
. 올바르게 수행했다면 파이썬 인터프리터 (즉시 종료 할 수 있음)를 얻게됩니다. 오류가 발생하면 제대로 수행하지 않은 것입니다.
이것에는 두 가지 문제가 있습니다 :
set PYTHON=%PYTHON%;D:\Python
먼저로 설정 PYTHON
합니다 ;D:\Python
. 이 세미콜론은 세미콜론으로 구분 된 경로 목록 ( PATH
또는 같은) PYTHONPATH
에는 적합하지만 같은 단일 값에는 적합하지 않습니다 PYTHON
. 마찬가지로 기존 값에 새 값을 추가하는 것은 경로 목록에 다른 경로를 추가하지만 단일 값이 아닌 다른 경로를 추가하려는 경우 원하는 것입니다. 그래서 당신은 단지 원합니다 set PYTHON=D:\Python
.
둘째, D:\Python
파이썬 인터프리터의 경로가 아닙니다. 이 같은 뭔가 D:\Python\Python.exe
, 또는 D:\Python\bin\Python.exe
. 올바른 경로를 찾아서 자체적으로 작동하는지 확인하십시오 (예 : D:\Python\bin\Python.exe
Python 인터프리터를 입력 하고 확인하십시오). 변수를 설정하고 사용하십시오.
그래서:
set PYTHON=D:\Python\bin\Python.exe
또는 영구적으로 만들려면 제어판에서 동등한 작업을 수행하십시오.
답변
모든 node-gyp 종속성과 함께 Python을 설치하지 않은 경우 관리자 권한으로 Powershell 또는 Git Bash를 열고 다음을 실행하십시오.
npm install --global --production windows-build-tools
그런 다음 패키지를 설치하십시오.
npm install --global node-gyp
설치가 완료되면 모든 node-gyp 종속성이 다운로드되지만 여전히 환경 변수가 필요합니다. 올바른 폴더에 Python이 있는지 확인하십시오.
C:\Users\ben\.windows-build-tools\python27\python.exe
참고-지원되지 않으므로 3.x가 아닌 python 2.7을 사용합니다.
신음하지 않으면 계속해서 (사용자) 환경 변수를 만듭니다.
setx PYTHON "%USERPROFILE%\.windows-build-tools\python27\python.exe"
cmd를 다시 시작하고 변수를 set PYTHON
반환 해야하는 변수가 있는지 확인하십시오.
마지막으로 다시 적용 npm install <module>
답변
아래 주석으로 windows-build-tools를 설치 한 후 나를 위해
npm --add-python-to-path='true' --debug install --global windows-build-tools
아래 코드를 실행
npm config set python "%USERPROFILE%\.windows-build-tools\python27\python.exe"
일했다.
답변
다음은 이러한 많은 문제를 해결 한 가이드입니다.
http://www.steveworkman.com/node-js/2012/installing-jsdom-on-windows/
특히 파이썬 버전이 중요하다는 것을 기억합니다. 3 대신 2.7.3을 설치하십시오.
답변
그 중 하나 및 / 또는 여러 개가 도움이 될 것입니다.
-
변수에 추가
C:\Python27\
하십시오PATH
(Python이이 디렉토리에 설치되었다는 것을 고려하십시오) env 변수
설정 방법PATH
: http://www.computerhope.com/issues/ch000549.htm 변수 를 설정
한 후 콘솔 및 / 또는 Windows를 다시 시작하십시오. -
위와 같은 섹션 ( “환경 변수”)에서 이름
PYTHON
과 값으로 새 변수 추가 변수를C:\Python27\python.exe
설정 한 후 콘솔 및 / 또는 Windows를 다시 시작하십시오. -
관리자 모드에서 Windows 명령 줄 (
cmd
) 을 엽니 다 .
Python 설치 경로로 디렉토리를 변경하십시오.cd C:\Python27
일부 설치에 필요한 symlink 를 작성하십시오 .mklink python2.7.exe python.exe
것을주세요 참고 하면, NOT 3.X를 파이썬 2.X가 있어야 실행,node-gyp
기반 설치를!
아래 텍스트는 Unix에 관한 것이지만 Windows 버전에는 Python 2.x가 필요합니다.
You can install with npm:
$ npm install -g node-gyp
You will also need to install:
On Unix:
python (v2.7 recommended, v3.x.x is not supported)
make
A proper C/C++ compiler toolchain, like GCC
이 기사는 또한 도움이 될 수 있습니다 : https://github.com/nodejs/node-gyp#installation
답변
나는 같은 문제가 있었고이 답변들 중 아무것도 도움이되지 못했습니다. 필자의 경우 PYTHON 변수가 올바르게 설정되었습니다. 그러나 파이썬이 너무 깊게 설치되었습니다. 즉 경로가 너무 깁니다. 그래서 다음을 수행했습니다.
- 파이썬을 c : \ python에 다시 설치했습니다.
- 환경 변수 PYTHON을 C : \ python \ python.exe로 설정하십시오.
그리고 그게 다야!
답변
도움이되었습니다 : https://www.npmjs.com/package/node-gyp
나는 다음 단계를 따랐다.
npm install -g node-gyp
그때:
npm install --global --production windows-build-tools
