前一天我得到了React Native。然后我在启动离子项目时犯了一个错误。 错误:找不到-bash:ionic:命令。 然后我移除了离子并想再次加载它。我犯了以下错误。我该怎么办?
CAN-MacBook-Pro:~ CAN$ sudo npm install -g cordova ionic
/Users/CAN/bin/cordova -> /Users/CAN/lib/node_modules/cordova/bin/cordova
/Users/CAN/bin/ionic -> /Users/CAN/lib/node_modules/ionic/bin/ionic
> fsevents@1.1.3 install /Users/CAN/lib/node_modules/ionic/node_modules/fsevents
> node install
node-pre-gyp ERR! Tried to download(undefined): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.1.3/fse-v1.1.3-node-v59-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for fsevents@1.1.3 and node@9.4.0 (node-v59 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! clean error
gyp ERR! stack Error: EACCES: permission denied, rmdir 'build'
gyp ERR! System Darwin 17.3.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 /Users/CAN/lib/node_modules/ionic/node_modules/fsevents
gyp ERR! node -v v9.4.0
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> (/Users/CAN/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:160: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.3.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/CAN/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 /Users/CAN/lib/node_modules/ionic/node_modules/fsevents
node-pre-gyp ERR! node -v v9.4.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
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.1.3 (node_modules/ionic/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 install: `node install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
+ cordova@8.0.0
+ ionic@3.19.0
updated 2 packages in 27.053s
CAN-MacBook-Pro:~ CAN$ ionic
-bash: ionic: command not found
&#13;
答案 0 :(得分:1)
您可以尝试将node和npm升级到最新版本,然后运行sudo npm install -g cordova ionic
命令