我正在尝试按照angularjs.org教程(https://docs.angularjs.org/tutorial)。它需要你安装和设置git,我在使一切工作时遇到一些麻烦。本教程的说明非常简单,所以不确定我哪里出错了。安装期间选择了所有默认选项。
在安装node.js和TRYING以安装项目所需的所有工具后,问题就开始了。我在git命令行和git bash中都试过这个(不确定区别是什么)。在安装node.js之后,教程说要将命令npm install
放到其他工具中,而在git bash中你得到这个
> bufferutil@1.2.1 install C:\Users\Ivan\angular-phonecat\node_modules\bufferutil
> node-gyp rebuild
C:\Users\Ivan\angular-phonecat\node_modules\bufferutil>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:401:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:356:11
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Ivan\angular-phonecat\node_modules\bufferutil
gyp ERR! node -v v5.6.0
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok
npm WARN install:bufferutil@1.2.1 bufferutil@1.2.1 install: `node-gyp rebuild`
npm WARN install:bufferutil@1.2.1 Exit status 1
> utf-8-validate@1.2.1 install C:\Users\Ivan\angular-phonecat\node_modules\utf-8-validate
> node-gyp rebuild
C:\Users\Ivan\angular-phonecat\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:401:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:356:11
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Ivan\angular-phonecat\node_modules\utf-8-validate
gyp ERR! node -v v5.6.0
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok
npm WARN install:utf-8-validate@1.2.1 utf-8-validate@1.2.1 install: `node-gyp rebuild`
npm WARN install:utf-8-validate@1.2.1 Exit status 1
> angular-phonecat@0.0.0 postinstall C:\Users\Ivan\angular-phonecat
> bower install
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.7
现在我首先在Git CMD中尝试了这个,我得到了类似这样的东西npm WARN deprecated graceful-fs@3.0.8: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
我刚刚在Git CMD中再次尝试过,现在看起来像是在bash中发生了同样的事情。我有节点版本5.6.0。
有人知道我应该从哪里出发吗?
好吧所以我最终做了@Oliver Queen发布的修复程序,除了我从GIT Bash而不是SDK 7.1({sdk找不到我保存项目的目录,我认为因为我记得在git安装期间只能使用Git Bash而不是windows cmd吗?)。似乎工作,这是我得到的
npm install
正如你在底部看到的那样我仍然得到
$ npm install
> bufferutil@1.2.1 install C:\Users\Ivan\angular-phonecat\node_modules\bufferuti l
> node-gyp rebuild
C:\Users\Ivan\angular-phonecat\node_modules\bufferutil>if not defined npm_config _node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\. .\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
bufferutil.cc
win_delay_load_hook.c
Creating library C:\Users\Ivan\angular-phonecat\node_modules\bufferutil\bui ld\Release\bufferutil.lib and object C:\Users\Ivan\angular-phonecat\node_modules \bufferutil\build\Release\bufferutil.exp
Generating code
Finished generating code
bufferutil.vcxproj -> C:\Users\Ivan\angular-phonecat\node_modules\bufferutil\b uild\Release\\bufferutil.node
> utf-8-validate@1.2.1 install C:\Users\Ivan\angular-phonecat\node_modules\utf-8 -validate
> node-gyp rebuild
C:\Users\Ivan\angular-phonecat\node_modules\utf-8-validate>if not defined npm_co nfig_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\ ..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
validation.cc
win_delay_load_hook.c
Creating library C:\Users\Ivan\angular-phonecat\node_modules\utf-8-validate \build\Release\validation.lib and object C:\Users\Ivan\angular-phonecat\node_mod ules\utf-8-validate\build\Release\validation.exp
Generating code
Finished generating code
validation.vcxproj -> C:\Users\Ivan\angular-phonecat\node_modules\utf-8-valida te\build\Release\\validation.node
> angular-phonecat@0.0.0 postinstall C:\Users\Ivan\angular-phonecat
> bower install
angular-phonecat@0.0.0 C:\Users\Ivan\angular-phonecat
`-- protractor@2.5.1
`-- selenium-webdriver@2.47.0
`-- ws@0.8.1
+-- bufferutil@1.2.1
| +-- bindings@1.2.1
| `-- nan@2.2.0
`-- utf-8-validate@1.2.1
`-- nan@2.2.0
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.7
我要担心吗?