无法安装ionic cordova

无法安装ionic cordova,cordova,ionic-framework,Cordova,Ionic Framework,我在尝试运行sudo npm安装-g ionic cordova时遇到这些错误 sudo npm install -g ionic cordova /usr/local/bin/cordova -> /usr/local/lib/node_modules/cordova/bin/cordova /usr/local/bin/ionic -> /usr/local/lib/node_modules/ionic/bin/ionic > fsevents@1.2.3 install

我在尝试运行
sudo npm安装-g ionic cordova时遇到这些错误

sudo npm install -g ionic cordova
/usr/local/bin/cordova -> /usr/local/lib/node_modules/cordova/bin/cordova
/usr/local/bin/ionic -> /usr/local/lib/node_modules/ionic/bin/ionic

> fsevents@1.2.3 install /usr/local/lib/node_modules/ionic/node_modules/fsevents
> node install

node-pre-gyp ERR! Pre-built binaries not installable for fsevents@1.2.3 and node@9.2.1 (node-v59 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp ERR! Hit error EACCES: permission denied, mkdir '/usr/local/lib/node_modules/ionic/node_modules/fsevents/lib/binding/Release/node-v59-darwin-x64' 
gyp ERR! clean error 
gyp ERR! stack Error: EACCES: permission denied, rmdir 'build'
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "clean"
gyp ERR! cwd /usr/local/lib/node_modules/ionic/node_modules/fsevents
gyp ERR! node -v v9.2.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:159:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:943:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
node-pre-gyp ERR! System Darwin 17.5.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/ionic/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/ionic/node_modules/fsevents
node-pre-gyp ERR! node -v v9.2.1
node-pre-gyp ERR! node-pre-gyp -v v0.9.1
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.3 (node_modules/ionic/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.3 install: `node install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ cordova@8.0.0
+ ionic@3.20.0
updated 2 packages in 13.581s
sudo npm安装-g爱奥尼亚科尔多瓦
/usr/local/bin/cordova->/usr/local/lib/node_modules/cordova/bin/cordova
/usr/local/bin/ionic->/usr/local/lib/node_模块/ionic/bin/ionic
> fsevents@1.2.3安装/usr/local/lib/node_modules/ionic/node_modules/fsevents
>节点安装
节点前gyp错误!无法为安装预构建的二进制文件fsevents@1.2.3和node@9.2.1(node-v59 ABI,未知)(使用node-gyp返回到源代码编译)
节点前gyp错误!命中错误:权限被拒绝,mkdir'/usr/local/lib/node_modules/ionic/node_modules/fsevents/lib/binding/Release/node-v59-darwin-x64'
哎呀!清除错误
哎呀!堆栈错误:EACCES:权限被拒绝,rmdir'build'
哎呀!达尔文系统17.5.0
哎呀!命令“/usr/local/bin/node”“/usr/local/lib/node_modules/npm/node_modules/node gyp/bin/node gyp.js”“clean”
哎呀!cwd/usr/local/lib/node_modules/ionic/node_modules/fsevents
哎呀!节点-v9.2.1
哎呀!节点gyp-v3.6.2
哎呀!不好
节点前gyp错误!构建错误
节点前gyp错误!堆栈错误:未能执行“/usr/local/bin/node/usr/local/lib/node_modules/npm/node_modules/node gyp/bin/node-gyp.js clean”(1)
节点前gyp错误!在子进程中进行堆栈。(/usr/local/lib/node_modules/ionic/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
节点前gyp错误!ChildProcess.emit上的堆栈(events.js:159:13)
节点前gyp错误!maybeClose的堆栈(内部/child_process.js:943:16)
节点前gyp错误!在Process.ChildProcess.\u handle.onexit(internal/child\u Process.js:220:5)处堆栈
节点前gyp错误!达尔文系统17.5.0
节点前gyp错误!命令“/usr/local/bin/node”“/usr/local/lib/node_modules/ionic/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp”“install”“--回退到构建”
节点前gyp错误!cwd/usr/local/lib/node_modules/ionic/node_modules/fsevents
节点前gyp错误!节点-v9.2.1
节点前gyp错误!gyp前节点-v v0.9.1
节点前gyp错误!不好
无法执行“/usr/local/bin/node/usr/local/lib/node_modules/npm/node_modules/node gyp/bin/node-gyp.js clean”(1)
npm警告可选跳过可选依赖项:fsevents@1.2.3(节点单元/离子单元/节点单元/fsevents):
npm警告可选跳过可选依赖项:fsevents@1.2.3install:`node install`
npm警告可选跳过可选依赖项:退出状态1
+ cordova@8.0.0
+ ionic@3.20.0
在13.581s中更新了2个软件包

我已尝试更新/安装node gyp并修复node_模块上的权限问题。

我认为下面的命令应该可以解决您的问题:

sudo npm install -g ionic cordova --unsafe-perm=true --allow-root

有关更多信息,请检查此线程:

我认为下面的命令应该可以解决您的问题:

sudo npm install -g ionic cordova --unsafe-perm=true --allow-root

有关更多信息,请查看此线程:

尝试“sudo npm安装-g ionic cordova”

尝试“sudo npm安装-g ionic cordova”

这些命令适用于我:

npm config set user 0
npm config set unsafe-perm true

这些命令对我有效:

npm config set user 0
npm config set unsafe-perm true