baileyherbert / utimes

šŸ•“ Cross-platform native addon to change the btime, mtime, and atime of files in Node.js.
https://npmjs.com/utimes
MIT License
47 stars 6 forks source link

Installation with npm fails #3

Closed SammyO closed 4 years ago

SammyO commented 4 years ago

Trying to install on my Mac (10.14.6), but getting error:

Sammys-MacBook-Pro-2:PhotoFrame sammy$ npm install utimes

> utimes@4.0.0 install /Users/sammy/pym-clone/REST/PhotoFrame/node_modules/utimes
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: Command failed: /Users/sammy/.pyenv/shims/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack 
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:289:12)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
gyp ERR! stack     at Socket.stream.socket.on (internal/child_process.js:381:11)
gyp ERR! stack     at Socket.emit (events.js:182:13)
gyp ERR! stack     at Pipe._handle.close (net.js:611:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/usr/local/Cellar/node/11.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/sammy/pym-clone/REST/PhotoFrame/node_modules/utimes
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! utimes@4.0.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the utimes@4.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sammy/.npm/_logs/2020-08-30T19_51_58_770Z-debug.log
SammyO commented 4 years ago

Might be Python version issue? I'm running Python 3.6.5.

baileyherbert commented 4 years ago

Yeah, you're running an older version of node-gyp that doesn't support Python 3. If you're able, try upgrading npm (npm install -g npm) to at least v6.13.7.

Alternatively, if you have Python 2 installed somewhere, you can give npm the path to that binary and it should start building. I'm not too familiar with mac, but from a quick search it seems there might be a system-managed binary at /usr/bin/python ā€“ can you try running /usr/bin/python -V to see if it's a valid Python 2 binary? If so, you can set the path like this:

npm config set python /usr/bin/python
SammyO commented 4 years ago

You're right. I managed to resolve it by installing Python 2.7 (using pyenv).

baileyherbert commented 4 years ago

Great to hear, let me know if you have any other issues šŸ˜„