创建项目时离子构建失败

时间:2019-04-28 17:38:24

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

我的系统中安装了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/velansalis/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/velansalis/.nvm/versions/node/v12.0.0/bin/node" "/home/velansalis/code/greenlink/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/velansalis/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

2 个答案:

答案 0 :(得分:4)

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

解决方案是将您的节点版本降级到v11或将您的节点自定义依赖项升级到最新版本。

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

答案 1 :(得分:0)

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

npm i --save-dev node@11