'gyp: binding.gyp not found
I am trying to install the necessary modules for running my web application. I am getting the following error while running $npm install :
john@mylaptop frontend % npm install
> [email protected] install /Users/john/workspace/myproject/frontend/node_modules/watchpack/node_modules/fsevents
> node-gyp rebuild
gyp: binding.gyp not found (cwd: /Users/john/workspace/myproject/frontend/node_modules/watchpack/node_modules/fsevents) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/Users/john/.nvm/versions/node/v6.11.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 21.3.0
gyp ERR! command "/Users/john/.nvm/versions/node/v6.11.0/bin/node" "/Users/john/.nvm/versions/node/v6.11.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/john/workspace/myproject/frontend/node_modules/watchpack/node_modules/fsevents
gyp ERR! node -v v6.11.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/watchpack/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
john@mylaptop frontend % node-gyp rebuild --verbose
gyp info it worked if it ends with ok
gyp verb cli [ '/Users/john/.nvm/versions/node/v6.11.0/bin/node',
gyp verb cli '/Users/john/.nvm/versions/node/v6.11.0/bin/node-gyp',
gyp verb cli 'rebuild',
gyp verb cli '--verbose' ]
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack /Users/john/.nvm/versions/node/v6.11.0/lib/node_modules/node-gyp/lib/create-config-gypi.js:18
gyp ERR! stack async function getBaseConfigGypi ({ gyp, nodeDir }) {
gyp ERR! stack ^^^^^^^^
gyp ERR! stack SyntaxError: Unexpected token function
gyp ERR! stack at createScript (vm.js:56:10)
gyp ERR! stack at Object.runInThisContext (vm.js:97:10)
gyp ERR! stack at Module._compile (module.js:542:28)
gyp ERR! stack at Object.Module._extensions..js (module.js:579:10)
gyp ERR! stack at Module.load (module.js:487:32)
gyp ERR! stack at tryModuleLoad (module.js:446:12)
gyp ERR! stack at Function.Module._load (module.js:438:3)
gyp ERR! stack at Module.require (module.js:497:17)
gyp ERR! stack at require (internal/module.js:20:19)
gyp ERR! stack at Object.<anonymous> (/Users/john/.nvm/versions/node/v6.11.0/lib/node_modules/node-gyp/lib/configure.js:10:26)
gyp ERR! System Darwin 21.3.0
gyp ERR! command "/Users/john/.nvm/versions/node/v6.11.0/bin/node" "/Users/john/.nvm/versions/node/v6.11.0/bin/node-gyp" "rebuild" "--verbose"
gyp ERR! cwd /Users/john/workspace/myproject/frontend
gyp ERR! node -v v6.11.0
gyp ERR! node-gyp -v v8.4.1
gyp ERR! Node-gyp failed to build your package.
gyp ERR! Try to update npm and/or node-gyp and if it does not help file an issue with the package author.
This is the node version I am using :
john@mylaptop frontend % npm version
{ frontend: '0.0.0',
npm: '3.10.10',
ares: '1.10.1-DEV',
http_parser: '2.7.0',
icu: '58.2',
modules: '48',
node: '6.11.0',
openssl: '1.0.2k',
uv: '1.11.0',
v8: '5.1.281.102',
zlib: '1.2.11' }
I don't want to upgrade npm or node versions for compatibility reasons with angular 4.4.6. Any help please. node was installed via nvm and not with brew.
Solution 1:[1]
Add file binding.gyp
{
'targets': [
{
'target_name': 'bindings',
'sources': [ 'bindings.node' ],
'cflags!': [ '-fno-exceptions' ],
'cflags_cc!': [ '-fno-exceptions' ],
'conditions': [
['OS=="mac"', {
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES'
}
}]
]
}
]
}
and rebuid node-gyp. $ node-gyp rebuild
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Joe Bobson |
