sproutcore / build-tools

SproutCore Build Tools
12 stars 7 forks source link

npm install fails on Windows 7 #73

Closed blaineadams closed 7 years ago

blaineadams commented 7 years ago

Install in on windows 7 x64 with npm 3.10.10 and node 6.9.4. In my environment I have to run npm with strict-ssl=false.

Exception is thrown in pre_install.js Here is the log output.

verbose stack Error: sproutcore@1.11.2-10 preinstall: `node pre_install.js`
verbose stack Exit status 1
verbose stack     at EventEmitter.<anonymous> (C:\Development\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
verbose stack     at emitTwo (events.js:106:13)
verbose stack     at EventEmitter.emit (events.js:191:7)
verbose stack     at ChildProcess.<anonymous> (C:\Development\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
verbose stack     at emitTwo (events.js:106:13)
verbose stack     at ChildProcess.emit (events.js:191:7)
verbose stack     at maybeClose (internal/child_process.js:877:16)
verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
verbose pkgid sproutcore@1.11.2-10
verbose cwd C:\Users\<user folder>
error Windows_NT 6.1.7601
error argv "C:\\Development\\nodejs\\node.exe" "C:\\Development\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "sproutcore" "--verbose"
error node v6.9.4
error npm  v3.10.10
error code ELIFECYCLE
error sproutcore@1.11.2-10 preinstall: `node pre_install.js`
error Exit status 1
error Failed at the sproutcore@1.11.2-10 preinstall script 'node pre_install.js'.
error Make sure you have the latest version of node.js and npm installed.
error If you do, this is most likely a problem with the sproutcore package,
error not with npm itself.
error Tell the author that this fails on your system:
error     node pre_install.js
error You can get information on how to open an issue for this project with:
error     npm bugs sproutcore
error Or if that isn't available, you can get their info via:
error     npm owner ls sproutcore
error There is likely additional logging output above.
verbose exit [ 1, true ]
mauritslamers commented 7 years ago

Thank you for this report! From the stack trace it is rather hard to figure out what goes wrong exactly. Would you be able to clone the build tools repository in the folder node_modules\sproutcore, edit the pre_install.js file by uncommenting the lines 43 to 49 and try to run the pre_install.js script manually? That should give me more information on what happens during pre_install. Thanks in advance!

mauritslamers commented 7 years ago

BTW: you can also edit the pre_install.js file and then simply run npm install in the root of the repository.

mauritslamers commented 7 years ago

Also, if you would join either the IRC channel (#sproutcore on freenode) or our channel on Gitter (https://gitter.im/sproutcore/sproutcore) I would be able to help you track the cause. Sadly, I don't have a Windows machine available to debug this problem.

blaineadams commented 7 years ago

Thank you for the quick response. Your suggestion above did not change the outcome. I need to try this on another windows computer if I can find one.

mauritslamers commented 7 years ago

I managed to trace your problem. It turns out there was also a problem in the post_install process, which was a nice bug which I knew had to exist, but which I didn't manage to track before. NPM package version 1.11.2-12. Fixed by ff800d757b384a7d9b4722811fe313f2d61127d6. Thanks again for reporting. If you happen to still have issues installing the latest npm package, please reopen this issue!

blaineadams commented 7 years ago

After testing the new 1.11.2-12 version on the same Windows 7 machine with node 6.9.5 32-bit I continue to get errors. I suspect it has more with my particular environment and I don't have the ability to test outside of here. On my MBP all is great when run as sudo to install the Build Tools.

However, I can clone the repo to my nodejs node_modules folder, run npm install and set up bash aliases and run the build tools on Windows 7. For this environment that will work just fine. I could test on Windows 10 at home to see how it works.

On Windows 7 the install works like a charm at the project level and the commands work. On Windows 7 for a global install the following happens, which I think is more environment related on this computer.

npm verb cli [ 'C:\\Development\\nodejs\\node.exe',
npm verb cli   'C:\\Development\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli   'install',
npm verb cli   'https://github.com/mauritslamers/node-canvas-builder/releases/download/v1.0/win_x86_6.0.tar.gz' ]
npm info using npm@3.10.10
npm info using node@v6.9.5
npm verb cache add spec https://github.com/mauritslamers/node-canvas-builder/releases/download/v1.0/win_x86_6.0.tar.gz
npm verb addRemoteTarball https://github.com/mauritslamers/node-canvas-builder/releases/download/v1.0/win_x86_6.0.tar.gz not in flight; adding
npm verb addRemoteTarball [ 'https://github.com/mauritslamers/node-canvas-builder/releases/download/v1.0/win_x86_6.0.tar.gz',
npm verb addRemoteTarball   null ]
npm info retry fetch attempt 1 at 9:58:44 AM
npm info attempt registry request try #1 at 9:58:44 AM
npm http fetch GET https://github.com/mauritslamers/node-canvas-builder/releases/download/v1.0/win_x86_6.0.tar.gz
npm verb request id 9a4b661941a8fad7
npm http fetch 200 https://github.com/mauritslamers/node-canvas-builder/releases/download/v1.0/win_x86_6.0.tar.gz
npm verb addTmpTarball C:\Users\<username>\AppData\Local\Temp\npm-6524-8f175f85\github.com\mauritslamers\node-canvas-builder\releases\download\v1.0\win_x86_6.0.tar.gz not in flight
npm verb correctMkdir C:\Users\<username>\AppData\Roaming\npm-cache correctMkdir not in flight; initializing
npm verb addTmpTarball validating metadata from C:\Users\<username>\AppData\Local\Temp\npm-6524-8f175f85\github.com\mauritslamers\node-canvas-builder\releases\download\v1.0\win_x86
npm verb tar unpack C:\Users\<username>\AppData\Local\Temp\npm-6524-8f175f85\github.com\mauritslamers\node-canvas-builder\releases\download\v1.0\win_x86_6.0.tar.gz
npm verb tar unpacking to C:\Users\<username>\AppData\Local\Temp\npm-6524-8f175f85\unpack-8c86137b
npm verb gentlyRm don't care about contents; nuking C:\Users\<username>\AppData\Local\Temp\npm-6524-8f175f85\unpack-8c86137b
npm verb correctMkdir C:\Users\<username>\AppData\Roaming\npm-cache correctMkdir not in flight; initializing
npm verb afterAdd C:\Users\<username>\AppData\Roaming\npm-cache\canvas-bin\1.3.7\package\package.json not in flight; writing
npm verb correctMkdir C:\Users\<username>\AppData\Roaming\npm-cache correctMkdir not in flight; initializing
npm verb afterAdd C:\Users\<username>\AppData\Roaming\npm-cache\canvas-bin\1.3.7\package\package.json written
npm verb correctMkdir C:\Users\<username>\AppData\Roaming\npm-cache\_locks correctMkdir not in flight; initializing
npm verb lock using C:\Users\<username>\AppData\Roaming\npm-cache\_locks\staging-b13c5e4694175891.lock for C:\Development\nodejs\node_modules\.staging
npm verb unlock done using C:\Users\<username>\AppData\Roaming\npm-cache\_locks\staging-b13c5e4694175891.lock for C:\Development\nodejs\node_modules\.staging
npm verb stack Error: EBUSY: resource busy or locked, rmdir 'C:\Development\nodejs\node_modules\.staging\sproutcore-b6b1f1c1'
npm verb stack     at Error (native)
npm verb cwd C:\Development\nodejs\node_modules\.staging\sproutcore-b6b1f1c1
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Development\\nodejs\\node.exe" "C:\\Development\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "https://github.com/mauritslamers/node-canvas-builder/releas_6.0.tar.gz"
npm ERR! node v6.9.5
npm ERR! npm  v3.10.10
npm ERR! path C:\Development\nodejs\node_modules\.staging\sproutcore-b6b1f1c1
npm ERR! code EBUSY
npm ERR! errno -4082
npm ERR! syscall rmdir

npm ERR! EBUSY: resource busy or locked, rmdir 'C:\Development\nodejs\node_modules\.staging\sproutcore-b6b1f1c1'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
npm verb exit [ -4082, true ]

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Development\nodejs\node_modules\.staging\sproutcore-b6b1f1c1\npm-debug.log
Error installing canvas-bin for your platform. Please report this issue!
undefined
{ Error: Command failed: npm install https://github.com/mauritslamers/node-canvas-builder/releases/download/v1.0/win_x86_6.0.tar.gz

I won't reopen this issue, but would like to see if other users are experiencing this with Windows in a less restrictive setting.

blaineadams commented 7 years ago

Continued testing this week with any windows 7 and 10 system I could find. Tried with Node in 6.x and 7.x versions. Results are always the same.

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Development\\nodejs\\node.exe" "C:\\Development\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "https://github.com/mauritslamers/node-canvas-builder/releases/download/v1.0/win_x64_7.0.tar.gz"
npm ERR! node v7.5.0
npm ERR! npm  v4.1.2
npm ERR! path C:\Development\nodejs\node_modules\.staging\sproutcore-846f5f01
npm ERR! code EBUSY
npm ERR! errno -4082
npm ERR! syscall rmdir

npm ERR! EBUSY: resource busy or locked, rmdir 'C:\Development\nodejs\node_modules\.staging\sproutcore-846f5f01'

The EBUSY error due to a locked resource during the install.

mauritslamers commented 7 years ago

I just tested on windows 10 Edge Evaluation edition, and with the exception of how to setup git I didn't really have issues.

To me this doesn't sound like a problem with the sproutcore package, but with a process interfering with npm during the installation. Some kind of anti-virus software or similar seems to me the most likely cause. Is it possible to turn off any kind of scanning software and rerun the install?

mauritslamers commented 7 years ago

For more information: https://github.com/npm/npm/issues/8564

blaineadams commented 7 years ago

Thanks for verifying you get a clean install on a Windows 10 computer. I am confident it is the network environment here causing the problems and not at all related to Node or Sproutcore. Thanks again.

mauritslamers commented 7 years ago

It does not sound like a network environment problem, unless the directory npm is writing to is on a NAS or SAN. Any other networking issue I would expect to result in a message that certain packages could not be downloaded.

The error message clearly states that something is using a temporary directory created by npm at the moment npm is trying to remove / delete that directory. Something is running on that machine which is reading or scanning that temporary directory at the same time npm is running. The only things I can imagine to do something like that are indexing services, backup services or anti-virus services.