unparagoned / njsTuya

Openhab interface for Tuya home automation devices sold under various names
27 stars 11 forks source link

npm install error #14

Closed PhynixP closed 5 years ago

PhynixP commented 5 years ago

Hello, i want install the npm and have follow errors

hope you can help me

Thanks

[12:01:30] openhabian@openHABianPi:/etc/openhab2/scripts$ sudo npm install unparagoned/njsTuya npm ERR! code 128 npm ERR! Command failed: git clone --mirror -q git://github.com/unparagoned/njsTuya.git /root/.npm/_cacache/tmp/git-clone-935de498/.git npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-935de498/.git' npm ERR!

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2019-02-26T11_03_20_401Z-debug.log

LOG: sudo cat /root/.npm/_logs/2019-02-26T11_03_20_401Z-debug.log 0 info it worked if it ends with ok 1 verbose cli [ '/usr/bin/node', 1 verbose cli '/usr/bin/npm', 1 verbose cli 'install', 1 verbose cli 'unparagoned/njsTuya' ] 2 info using npm@6.8.0 3 info using node@v10.15.1 4 verbose npm-session 6bd878f94f845d5d 5 silly install loadCurrentTree 6 silly install readLocalPackageData 7 silly fetchPackageMetaData error for github:unparagoned/njsTuya Command failed: git clone --mirror -q git://github.com/unparagoned/njsTuya.git /root/.npm/_cacache/tmp/git-clone-935de498/.git 7 silly fetchPackageMetaData fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-935de498/.git' 8 timing stage:rollbackFailedOptional Completed in 2ms 9 timing stage:runTopLevelLifecycles Completed in 773ms 10 verbose stack Error: Command failed: git clone --mirror -q git://github.com/unparagoned/njsTuya.git /root/.npm/_cacache/tmp/git-clone-935de498/.git 10 verbose stack fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-935de498/.git' 10 verbose stack 10 verbose stack at ChildProcess.exithandler (child_process.js:294:12) 10 verbose stack at ChildProcess.emit (events.js:189:13) 10 verbose stack at maybeClose (internal/child_process.js:970:16) 10 verbose stack at Socket.stream.socket.on (internal/child_process.js:389:11) 10 verbose stack at Socket.emit (events.js:189:13) 10 verbose stack at Pipe._handle.close (net.js:600:12) 11 verbose cwd /etc/openhab2/scripts 12 verbose Linux 4.14.98-v7+ 13 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "unparagoned/njsTuya" 14 verbose node v10.15.1 15 verbose npm v6.8.0 16 error code 128 17 error Command failed: git clone --mirror -q git://github.com/unparagoned/njsTuya.git /root/.npm/_cacache/tmp/git-clone-935de498/.git 17 error fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-935de498/.git' 18 verbose exit [ 1, true ] [12:04:36] openhabian@openHABianPi:/etc/openhab2/scripts$

unparagoned commented 5 years ago

That looks like a permissions error. In theory you shouldn't need sudo but it is required on some systems due to to permission issues. So try without sudo.

npm install unparagoned/njsTuya

Otherwise try

sudo -i -u openhabian npm install unparagoned/njsTuya

Or if that doesn't work you should just delete or fix the permissions of /root/.npm/_cacache. You probably have user permissions rather than root or vise versa.

sudo chown openhabian:root /root/.npm/_cacache
or 
sudo chown root:openhabian /root/.npm/_cacache