【问题标题】:unable to install ionic in windows无法在 Windows 中安装 ionic
【发布时间】:2017-04-28 03:54:02
【问题描述】:

参考堆栈溢出link中已经发布的问题,我只是跟进了ionic的基本安装过程,但突然之间出现了这个奇怪的错误。

gyp verb could not find "python". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
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:\Users\kevin\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\node_modules\node-sass\node_modules\node-gyp\lib\configure.js:401:14)
gyp ERR! stack     at C:\Users\kevin\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\node_modules\node-sass\node_modules\node-gyp\lib\configure.js:356:11
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:111:15)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\kevin\\AppData\\Roaming\\npm\\node_modules\\ionic\\node_modules\\ionic-app-lib\\node_modules\\node-sass\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\kevin\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\node_modules\node-sass
gyp ERR! node -v v7.2.1
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
Build failed
npm WARN Error: EPERM: operation not permitted, lstat 'C:\Users\kevin\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\node_modules\node-sass\node_modules\meow\node_modules\redent\node_modules\indent-string\node_modules'
npm WARN  { Error: EPERM: operation not permitted, lstat 'C:\Users\kevin\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\node_modules\node-sass\node_modules\meow\node_modules\redent\node_modules\indent-string\node_modules'npm WARN   errno: -4048,
npm WARN   code: 'EPERM',
npm WARN   syscall: 'lstat',
npm WARN   path: 'C:\\Users\\kevin\\AppData\\Roaming\\npm\\node_modules\\ionic\\node_modules\\ionic-app-lib\\node_modules\\node-sass\\node_modules\\meow\\node_modules\\redent\\node_modules\\indent-string\\node_modules' }
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\kevin\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "ionic@1.7"
npm ERR! node v7.2.1
npm ERR! npm  v4.0.3
npm ERR! code ELIFECYCLE

npm ERR! node-sass@3.8.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@3.8.0 postinstall script 'node scripts/build.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node scripts/build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs node-sass
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls node-sass
npm ERR! There is likely additional logging output above.

screen shot of error captured during ionic installation

我尝试了以下步骤作为安装过程

  • 已安装node.js 最新7.2.1 v - 安装成功
  • npm install -g cordova - 安装成功
  • npm install -g ionic@1.7 - 失败。

附上捕获的日志以供参考。 npm-debug.log

【问题讨论】:

    标签: python ionic-framework npm installation


    【解决方案1】:

    好像你没有安装python,先安装python

    如果python存在,则由set PYTHON=C:\Python27\Python.exe设置路径,如果python安装在默认路径,否则将其更改为python所在的位置。

    【讨论】:

    • 嗨@ArduinoSentinel,我已经安装了最新版本的python'3.5.2'。它安装在以下路径: C:\Users\kevin\AppData\Local\Programs\Python\Python35-32 。我还使用命令 set PYTHON=C:\Users\kevin\AppData\Local\Programs\Python\Python35-32 设置了路径,但错误仍然存​​在。
    • 为什么要安装在那里,放python的最佳位置是`C:`目录
    • 我已经重新安装了python(自定义)。在 C:\ 下创建了一个文件夹“Python27”,将 python 安装在 C:\Python27 ,这次它给了我以下错误:gyp verb check python checking for Python executable "C:\Python27\Python.exe" in the PATH gyp verb check python version C:\Python27\Python.exe -c "import platform; print(platform.python_version());" returned: "3.5.2\r\n" gyp ERR! configure error gyp ERR! stack Error: Python executable "C:\Python27\Python.exe" is v3.5.2, which is not supported by gyp. gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
    • 这意味着不支持python 版本它不应该低于2.5.0 并且不高于v3.0.0 这意味着你应该安装python2 版本,从这里下载Pyrhon 2.7.12_x64 用于 64 位或 Python 2.7.12_x86 用于 32 位
    • 问题现已解决,我已卸载 3.5.2 并将 2.7.12 安装到同一位置 C:\Python27 这次 ionic 安装成功。谢谢@Arduino
    猜你喜欢
    • 2018-11-26
    • 1970-01-01
    • 2017-06-01
    • 2020-08-24
    • 1970-01-01
    • 1970-01-01
    • 2017-10-26
    • 2017-08-29
    • 1970-01-01
    相关资源
    最近更新 更多