September 27, 2016

FEDORA安装electron-builder报错make:g++:命令未找到之解决

Tags: Fedoranpmerror | (2 min read)
  • 系统环境: Fedora 24
  • Node v4.5.0
  • NPM v2.15.9

NPM安装electron-builder报错

$npm install electron-builder --save=dev
npm WARN package.json test@1.0.0 No repository field.
npm WARN package.json test@1.0.0 No README data
 
> inotify@1.4.1 install /var/www/html/test/node_modules/dev/node_modules/inotify
> node-gyp rebuild

make: Entering directory '/var/www/html/test/node_modules/dev/node_modules/inotify/build'
  CXX(target) Release/obj.target/inotify/src/bindings.o
make: g++:命令未找到
inotify.target.mk:97: recipe for target 'Release/obj.target/inotify/src/bindings.o' failed
make: *** [Release/obj.target/inotify/src/bindings.o] Error 127
make: Leaving directory '/var/www/html/test/node_modules/dev/node_modules/inotify/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.7.4-200.fc24.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/html/test/node_modules/dev/node_modules/inotify
gyp ERR! node -v v4.5.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
npm WARN optional dep failed, continuing appdmg-tf@0.4.9
npm WARN deprecated lodash.assign@4.2.0: This package is deprecated. Use Object.assign.
npm WARN optional dep failed, continuing 7zip-bin-win@2.0.1
npm WARN optional dep failed, continuing 7zip-bin-osx@1.0.0
npm ERR! Linux 4.7.4-200.fc24.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "electron-builder" "--save=dev"
npm ERR! node v4.5.0
npm ERR! npm  v2.15.9
npm ERR! code ELIFECYCLE

npm ERR! inotify@1.4.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the inotify@1.4.1 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the inotify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs inotify
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls inotify
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /var/www/html/test/npm-debug.log

解决方法:

  • 安装G++ $sudo dnf install gcc-c++