OpenZWave / node-openzwave-shared

OpenZWave addon for Node.js (all versions) including management and security functions
Other
198 stars 113 forks source link

npm install -g openzwave-shared not works on windows 10 / 7 #157

Closed francescozambon4 closed 6 years ago

francescozambon4 commented 7 years ago

Hi, the command npm install -g openzwave-shared fails due to resource busy or locked error. I've tried with Windows 10 / 7 and with Node.js 6.10.2 and Node.js 7.8.0. I've also deleted my temp folder, execute npm clean cache and run node as Administrator. Please can you help me?

This is my last log:

    at checkExecSyncError (child_process.js:481:13)
    at Object.execSync (child_process.js:521:13)
    at Module.module.exports (C:\Users\francesco\AppData\Roaming\npm\node_modules\.staging\openzwave-shared-bf844019\lib\install-ozw.js:164:16)
    at Object.<anonymous> (C:\Users\francesco\AppData\Roaming\npm\node_modules\.staging\openzwave-shared-bf844019\lib\install-ozw.js:220:12)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "openzwave-shared"
npm ERR! node v7.8.0
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1

npm ERR! openzwave-shared@1.3.3 preinstall: `node lib/install-ozw.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the openzwave-shared@1.3.3 preinstall script 'node lib/install-ozw.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the openzwave-shared package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node lib/install-ozw.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs openzwave-shared
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls openzwave-shared
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\francesco\AppData\Roaming\npm-cache\_logs\2017-04-09T10_28_32_929Z-debug.log
francescozambon4 commented 7 years ago
C:\Users\francesco>npm install -g openzwave-shared

> openzwave-shared@1.3.3 preinstall C:\Users\francesco\AppData\Roaming\npm\node_modules\.staging\openzwave-shared-bf844019
> node lib/install-ozw.js

Installing Open Z-Wave
Installing dependencies to C:\Users\FRANCE~1\AppData\Local\Temp\ozwinstall-bcre99vuh3uz0qnnrk9
npm WARN deprecated wrench@1.5.9: wrench.js is deprecated! You should check out fs-extra (https://github.com/jprichardson/node-fs-extra) for any operations you were using wrench for. Thanks for all the usage over the years.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "request" "unzip" "node-gyp" "wrench"
npm ERR! node v7.8.0
npm ERR! npm  v4.2.0
npm ERR! path C:\Users\francesco\AppData\Roaming\npm\node_modules\.staging\openzwave-shared-bf844019
npm ERR! code EBUSY
npm ERR! errno -4082
npm ERR! syscall rmdir

npm ERR! EBUSY: resource busy or locked, rmdir 'C:\Users\francesco\AppData\Roaming\npm\node_modules\.staging\openzwave-shared-bf844019'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\francesco\AppData\Roaming\npm-cache\_logs\2017-04-09T10_28_17_037Z-debug.log
child_process.js:524
    throw err;
    ^

Error: Command failed: npm install request unzip node-gyp wrench
npm WARN deprecated wrench@1.5.9: wrench.js is deprecated! You should check out fs-extra (https://github.com/jprichardson/node-fs-extra) for any operations you were using wrench for. Thanks for all the usage over the years.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "request" "unzip" "node-gyp" "wrench"
npm ERR! node v7.8.0
npm ERR! npm  v4.2.0
npm ERR! path C:\Users\francesco\AppData\Roaming\npm\node_modules\.staging\openzwave-shared-bf844019
npm ERR! code EBUSY
npm ERR! errno -4082
npm ERR! syscall rmdir

npm ERR! EBUSY: resource busy or locked, rmdir 'C:\Users\francesco\AppData\Roaming\npm\node_modules\.staging\openzwave-shared-bf844019'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\francesco\AppData\Roaming\npm-cache\_logs\2017-04-09T10_28_17_037Z-debug.log

    at checkExecSyncError (child_process.js:481:13)
    at Object.execSync (child_process.js:521:13)
    at Module.module.exports (C:\Users\francesco\AppData\Roaming\npm\node_modules\.staging\openzwave-shared-bf844019\lib\install-ozw.js:164:16)
    at Object.<anonymous> (C:\Users\francesco\AppData\Roaming\npm\node_modules\.staging\openzwave-shared-bf844019\lib\install-ozw.js:220:12)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "openzwave-shared"
npm ERR! node v7.8.0
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1

npm ERR! openzwave-shared@1.3.3 preinstall: `node lib/install-ozw.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the openzwave-shared@1.3.3 preinstall script 'node lib/install-ozw.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the openzwave-shared package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node lib/install-ozw.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs openzwave-shared
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls openzwave-shared
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\francesco\AppData\Roaming\npm-cache\_logs\2017-04-09T10_28_32_929Z-debug.log
ekarak commented 7 years ago

I'm sorry, I have no Windows development environment. @ldhertert any ideas?

ekarak commented 7 years ago

The only thing I can think of right now is to clone this repo, and comment out the rmDirSyncRecursive call within lib/install-ozw.js.

function init() {
  console.log('Temp Path:', tempPath);
  console.log('Install Path:', installPath);

//  wrench.rmdirSyncRecursive(installPath, true);
  wrench.mkdirSyncRecursive(installPath);
}

Then try installing by pointing npm to your local repo (instead of a package name): npm install -g .

ldhertert commented 7 years ago

Sorry I've moved to osx pretty much full time, can't really help anymore.

Isaksson commented 7 years ago

Any news on this issue? I tried with the suggestion but still error, including log. npm-debug.zip

Isaksson commented 7 years ago

Okey, i have now spent some time with this issue and it seems that the issue is this command ChildProcess.execSync('npm install request unzip node-gyp wrench');

This is how made a workaround just when testing. First make the tempPath permanent (also create that folder) var tempPath = path.resolve(require('os').tmpdir() + '/ozwinstall-test');

Manually install the dependencies in the tempPath folder with the command npm install request unzip node-gyp wrench --save

Comment out this fs.mkdirSync(tempPath); and ChildProcess.execSync('npm install request unzip node-gyp wrench');

Now the script will continue as it should, in my case it failed on Error: Can't find Python executable "python", you can set the PYTHON env variable. But that is another story.

From what I could see it seems that ChildProcess.execSync('npm install request unzip node-gyp wrench'); does not install the dependencies in the correct folder.

Maybe this information could help?

arasium commented 7 years ago

Hi, to avoid any problem, you must install this:

npm install --global windows-build-tools

It will install prerequisites generally used by node packages.

There is also an error in the test2.js script. At the begining, on the device list, replace "windows" by win32 since os.platform() return win32 and not windows.

Isaksson commented 7 years ago

npm install --global windows-build-tools will solve the Python issue but you mean that it also solves the other issue?

arasium commented 7 years ago

Yes, it has solved all my issues (Python, MSBuild etc...) Before running this command, I've removed the Python version I had on my computer to avoid conflicts. And these build tools will install a quite large set of tools: https://github.com/felixrieseberg/windows-build-tools

Perhaps you can install them one by one manually if you prefer to know what you are installing on your computer.

Isaksson commented 7 years ago

Thanks for the information, I will also test and hope it will solve the issues :)

Isaksson commented 7 years ago

I have now tested and still same problem even after installation of windows-build-tools. I will continue to make a temporary fix for this.

Isaksson commented 7 years ago

The fix is now available, download and install from that folder. https://github.com/Isaksson/node-openzwave-shared

Instructions:

Install windows-build-tools npm install --global windows-build-tools

Install this module from the folder where you unzipped it npm install -g

AmigaZoid commented 7 years ago

Does not install

HellandB commented 7 years ago

I tried installing the official version from OpenZWave, but it failed, see my other forum post for details.

I tried with isaksson's build which is giving me this error. Anyone know how I can proceed?


C:\Users\xbmc\.node-red>npm i isaksson/node-openzwave-shared

> openzwave-shared@1.3.4 preinstall C:\Users\xbmc\.node-red\node_modules\.stagi
g\openzwave-shared-fee7883d
> node lib/install-ozw.js

Installing Open Z-Wave
C:\Users\xbmc\AppData\Local\Temp\ozwinstall-test
Installing dependencies to C:\Users\xbmc\AppData\Local\Temp\ozwinstall-test
Downloading open zwave source.
Extracting open zwave source.
Building open zwave
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
C:\Users\xbmc\AppData\Local\Temp\ozwinstall-test\ozw\open-zwave-master\build\op
enzwave.vcxproj(20,3): error MSB4019: The imported project "C:\Microsoft.Cpp.De
fault.props" was not found. Confirm that the path in the <Import> declaration i
s correct, and that the file exists on disk.
C:\Users\xbmc\.node-red\node_modules\.staging\openzwave-shared-fee7883d\lib\ins
all-ozw.js:182
  throw err;
  ^

Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with
xit code: 1
    at ChildProcess.onExit (C:\Users\xbmc\AppData\Local\Temp\ozwinstall-test\no
e_modules\node-gyp\lib\build.js:285:23)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\
node_modules\\npm\\bin\\npm-cli.js" "i" "isaksson/node-openzwave-shared"
npm ERR! node v6.11.2
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! openzwave-shared@1.3.4 preinstall: `node lib/install-ozw.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the openzwave-shared@1.3.4 preinstall script 'node lib/insta
l-ozw.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the openzwave-shared pac
age,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node lib/install-ozw.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs openzwave-shared
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls openzwave-shared
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\xbmc\.node-red\npm-debug.log

C:\Users\xbmc\.node-red>
JonSilver commented 7 years ago

@Isaksson Your fixed worked for me - nothing else did. The instructions in the ReadMe here were of no help at all.

HellandB commented 7 years ago

@JonSilver Would be great if you could provide a step by step guide on how you did the install. I am still struggeling...

JonSilver commented 7 years ago

@HellandB to use the fix from @Isaksson I included it in my package.json as a dependency.

Where you might normally do something like this:

    "dependencies": {
        "openzwave-shared": "^1.4.0"
    },

instead do this:

    "dependencies": {
        "openzwave-shared": "git+https://github.com/Isaksson/node-openzwave-shared"
    },

and then execute a npm install which should work. It probably helps having the windows build tools installed too.

Note this is unnecessary when targeting a Debian/Raspbian environment, but doesn't seem to hurt if you're aiming for cross-platform installs like I am (dev on Windows, deploy on Raspbian).

Let me know if this works for you or if you're still having problems, and I'll try to pull out more detail.

ekarak commented 6 years ago

Version 1.4.3 just released. This includes the fix in #222 and adds Appveyor CI support for Windows builds.