Ionic 2 安装问题

Ionic 2 installation issues

我正在尝试在 Windows 7 x64 位上使用 Ionic 2,但在使用 ionic start 命令时卡住了。我曾尝试阅读教程和安装说明,但没有成功。这是我的问题的详细信息:

  1. 在 cordova 和 ionic 安装期间发现折旧警告:

https://postimg.org/image/vf3qn8z9b/

  1. 然后在 ionic 中使用以下命令显示错误:

    ionic 启动 newProject sidemenu --v2

https://postimg.org/image/4vz80prq5/

我的 npm-debug.log 的上下文:

 9284 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
    69285 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.15: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32"})
    69286 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
    69286 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
    69286 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   win32
    69286 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: ia32
    69287 verbose stack Error: node-sass@3.10.1 postinstall: `node scripts/build.js`
    69287 verbose stack Exit status 1
    69287 verbose stack     at EventEmitter.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
    69287 verbose stack     at emitTwo (events.js:106:13)
    69287 verbose stack     at EventEmitter.emit (events.js:191:7)
    69287 verbose stack     at ChildProcess.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
    69287 verbose stack     at emitTwo (events.js:106:13)
    69287 verbose stack     at ChildProcess.emit (events.js:191:7)
    69287 verbose stack     at maybeClose (internal/child_process.js:885:16)
    69287 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
    69288 verbose pkgid node-sass@3.10.1
    69289 verbose cwd C:\Users\Lime\newIonicProj
    69290 error Windows_NT 6.1.7601
    69291 error argv "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install"
    69292 error node v7.3.0
    69293 error npm  v3.10.10
    69294 error code ELIFECYCLE
    69295 error node-sass@3.10.1 postinstall: `node scripts/build.js`
    69295 error Exit status 1
    69296 error Failed at the node-sass@3.10.1 postinstall script 'node scripts/build.js'.
    69296 error Make sure you have the latest version of node.js and npm installed.
    69296 error If you do, this is most likely a problem with the node-sass package,
    69296 error not with npm itself.
    69296 error Tell the author that this fails on your system:
    69296 error     node scripts/build.js
    69296 error You can get information on how to open an issue for this project with:
    69296 error     npm bugs node-sass
    69296 error Or if that isn't available, you can get their info via:
    69296 error     npm owner ls node-sass
    69296 error There is likely additional logging output above.
    69297 verbose exit [ 1, true ]

应用解决方案:

  1. 已安装 nodejs 7.3.0(当前版本)。

注意:我尝试安装 x64 位,但由于出现错误,所以我切换到 x86 版本,但仍然没有成功。我也尝试过将 nodejs 降级到 6.9.2 和 v4.4.7,但一点进展都没有。

  1. 使用 "npm install -g npm" 升级了 npm,清除缓存并更新注册表

  2. 试图重建节点-sass

  3. 尝试手动安装 minimatch、uuid 和 fsevents

知道吗,我在安装过程中错过了什么?我在使用离子版本 1 创建项目时遇到了同样的问题。

经过一系列卸载和安装所有依赖后,我发现问题是因为node-sass与当前版本的nodejs不兼容。我已经通过以下方式解决了这个问题:

  1. 正在安装 x86 nodejs 版本 7.3.0
  2. 安装 cordova 和 ionic(非测试版)
  3. 更新节点-sass "install -g node-sass"
  4. 使用命令"npm rebuild node-sass"
  5. 再次构建节点-sass

之后,当我尝试运行 "ionic serve" 命令时,出现错误。错误消息是:

"Ionic serve error: Error: ENOENT: no such file or directory, open '/home/.../IonicTest/www/index.html'"

  1. 运行命令"npm run build"reference:

干杯!它已经在工作了:D

是的,节点 7 需要 node.sass v13.12.0 或更高版本

69288 详细 pkgid 节点-sass@3.10.1 69289 详细 cwd C:\Users\Lime\newIonicProj 69290 错误 Windows_NT 6.1.7601 69291 错误 argv "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install" 69292 错误节点 v7.3.0

在此处查看支持的版本:https://github.com/sass/node-sass/releases?after=3.4.0-RC1