【问题标题】:Ionic Framework : Ionic build fails while creating the project (v4.12.0)离子框架:创建项目时离子构建失败(v4.12.0)
【发布时间】:2019-09-17 11:04:45
【问题描述】:

我的系统中安装了ionic。当我运行ionic run app tabs 时,它会安装所有npm 包,但随后提示会落到

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.11.0/linux-x64-72_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.11.0/linux-x64-72_binding.node":

HTTP error 404 Not Found

然后它失败并显示提示

gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/l3g0b0y/code/greenlink/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:196:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:256:12)
gyp ERR! System Linux 4.15.0-47-generic
gyp ERR! command "/home/l3g0b0y/.nvm/versions/node/v12.0.0/bin/node" "/home/l3g0b0y/code/greenlink/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/l3g0b0y/code/greenlink/node_modules/node-sass
gyp ERR! node -v v12.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Build failed with error code: 1
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.8 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.8: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.11.0 (node_modules/node-sass):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.11.0 postinstall: `node scripts/build.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

我已经尝试删除 node_modules 并重新安装软件包。我也尝试重新安装ionic-cli。哪个不行。

我正在使用 node v12.0.0 npm v6.9.0 ionic v4.12.0

【问题讨论】:

  • 运行sudo npm rebuild node-sass 然后ionic run app tabs
  • 确实,github 上没有这个包:curl -I https://github.com/sass/node-sass/releases/download/v4.11.0/linux-x64-72_binding.node HTTP/1.1 404 Not Foundnpm rebuild 不应该在这里产生任何影响

标签: node.js ionic-framework npm build installation


【解决方案1】:

确实,https://github.com/sass/node-sass/releases/download/v4.11.0/linux-x64-72_binding.node 版本不可用,因为您使用的是节点 v12,并尝试为节点 v12 获取不受支持的 node-sass 版本。

解决方案是将你的 node 版本降级到v11 或将你的 node-sass 依赖升级到最新。

如果您(对于与另一个库有相同问题的访问者。这里是 ionic)正在使用 node-sass 作为供应商库,请降级到节点 v11 并通知库开发团队需要更新。

【讨论】:

  • 非常感谢。解决了我的问题 :) 我要在 github 上提出这个问题。
  • 进入节点模块并修复 node-sass 依赖项对我有用。我用npm ls node-sass 找到了它们。祝你好运!
【解决方案2】:

另一种选择是将节点 11 添加到您的开发依赖项:

npm i --save-dev node@11

【讨论】:

    猜你喜欢
    • 2018-10-18
    • 2021-05-08
    • 2016-08-19
    • 2016-06-17
    • 1970-01-01
    • 1970-01-01
    • 2023-03-25
    • 1970-01-01
    相关资源
    最近更新 更多