Error occur as below, need help :
C:\xampp\htdocs\ANGULAR_PROJECT\vQr>npm i @zxing/ngx-scanner@latest --save
[email protected] install C:\xampp\htdocs\ANGULAR_PROJECT\vQrnode_modulessharp
node-gyp rebuild
C:\xampp\htdocs\ANGULAR_PROJECT\vQr\node_modules\sharp>if not defined npm_config_node_gyp (node "C:\Users\yen-yee.wong\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Users\yen-yee.wong\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Users\yen-yee.wong\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder.<anonymous> (C:\Users\yen-yee.wong\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Users\yen-yee.wong\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\yen-yee.wong\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\xampp\htdocs\ANGULAR_PROJECT\vQr\node_modules\sharp
gyp ERR! node -v v8.9.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EPERM: operation not permitted, scandir 'C:\xampp\htdocs\ANGULAR_PROJECT\vQr\node_modules\sharp\node_modules'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EPERM: operation not permitted, rmdir 'C:\xampp\htdocs\ANGULAR_PROJECT\vQr\node_modules\fsevents\node_modules'
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EPERM: operation not permitted, rmdir 'C:\xampp\htdocs\ANGULAR_PROJECT\vQr\node_modules\fsevents\node_modules'
npm WARN @angular/[email protected] requires a peer of @angular/core@~5.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of @angular/common@~5.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of @angular/core@~5.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of @angular/common@~5.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of @angular/core@~5.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of @angular/common@~5.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@^2.4.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/common@^2.4.0 || ^4.0.0 but none is installed. You must install peer dependencies
yourself.
npm WARN [email protected] requires a peer of @angular/core@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
This is probably a problem with your environment, please try to install:
npm install --global --production windows-build-tools
...and try again.
I have the same issue and the solution from @werthdavid did not work.
I found out that the issue is in @zxing-web/library with sharp 0.19.1. With sharp 0.20.0 the issue does not appear. I created a PR https://github.com/zxing-web/library/pull/10
I see your problem, but this is in fact a environment problem. The sharp package is not friendly for Windows environments (or for any environment, maybe).
I had this problem too in the past and it is a pain in the ass and very hard to track down the real problem to solve.
I merged the @Nightapes PR at @zxing-web/library repo and I will publish the package ASAP. But keep in mind that the error may not disappear, as it is an environment issue that has nothing to do with @angular/cli.
Just to share with you guys, this is what happens when npm install in zxing library:
~/Projects/zxing-web/library (master)
$ npm install
npm WARN deprecated [email protected]: All versions below 4.0.1 of Nodemailer are deprecated. See https://nodemailer.com/status/
npm WARN deprecated [email protected]: Use uuid module instead
> [email protected] install C:\Users\67390\Projects\zxing-web\library\node_modules\uws
> node-gyp rebuild > build_log.txt 2>&1 || exit 0
> [email protected] install C:\Users\67390\Projects\zxing-web\library\node_modules\phantomjs-prebuilt
> node install.js
PhantomJS not found on PATH
Download already available at C:\Users\67390\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-windows.zip
Verified checksum of previously downloaded file
Extracting zip contents
Removing C:\Users\67390\Projects\zxing-web\library\node_modules\phantomjs-prebuilt\lib\phantom
Copying extracted folder C:\Users\67390\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-windows.zip-extract-1521118385189\phantomjs-2.1.1-windows -> C:\Users\67390\Projects\zxing-web\library\node_modules\phantomjs-prebuilt\lib\phantom
Writing location.js file
Done. Phantomjs binary available at C:\Users\67390\Projects\zxing-web\library\node_modules\phantomjs-prebuilt\lib\phantom\bin\phantomjs.exe
> [email protected] install C:\Users\67390\Projects\zxing-web\library\node_modules\sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.6.1/libvips-8.6.1-win32-x64.tar.gz
info sharp Creating C:\Users\67390\Projects\zxing-web\library\node_modules\sharp\build\Release
info sharp Copying DLLs from C:\Users\67390\Projects\zxing-web\library\node_modules\sharp\vendor\lib to C:\Users\67390\Projects\zxing-web\library\node_modules\sharp\build\Release
prebuild-install info begin Prebuild-install version 2.5.1
prebuild-install info looking for local prebuild @ prebuilds\sharp-v0.20.0-node-v57-win32-x64.tar.gz
prebuild-install info looking for cached prebuild @ C:\Users\67390\AppData\Roaming\npm-cache\_prebuilds\https-github.com-lovell-sharp-releases-download-v0.20.0-sharp-v0.20.0-node-v57-win32-x64.tar.gz
prebuild-install http request GET https://github.com/lovell/sharp/releases/download/v0.20.0/sharp-v0.20.0-node-v57-win32-x64.tar.gz
prebuild-install http 200 https://github.com/lovell/sharp/releases/download/v0.20.0/sharp-v0.20.0-node-v57-win32-x64.tar.gz
prebuild-install info downloading to @ C:\Users\67390\AppData\Roaming\npm-cache\_prebuilds\https-github.com-lovell-sharp-releases-download-v0.20.0-sharp-v0.20.0-node-v57-win32-x64.tar.gz.29084-ea6877ce66f2a.tmp
prebuild-install info renaming to @ C:\Users\67390\AppData\Roaming\npm-cache\_prebuilds\https-github.com-lovell-sharp-releases-download-v0.20.0-sharp-v0.20.0-node-v57-win32-x64.tar.gz
prebuild-install info unpacking @ C:\Users\67390\AppData\Roaming\npm-cache\_prebuilds\https-github.com-lovell-sharp-releases-download-v0.20.0-sharp-v0.20.0-node-v57-win32-x64.tar.gz
prebuild-install info unpack resolved to C:\Users\67390\Projects\zxing-web\library\node_modules\sharp\build\Release\sharp.node
prebuild-install info unpack required C:\Users\67390\Projects\zxing-web\library\node_modules\sharp\build\Release\sharp.node successfully
prebuild-install info install Successfully installed prebuilt binary!
> [email protected] postinstall C:\Users\67390\Projects\zxing-web\library\node_modules\webpack\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js
> [email protected] postinstall C:\Users\67390\Projects\zxing-web\library\node_modules\sinon
> node -e "console.log('\u001b[32mLove sinon? You can now support the project via the open collective:\u001b[22m\u001b[39m\n > \u001b[96m\u001b[1mhttps://opencollective.com/sinon/donate\u001b[0m\n')" || exit 0
Love sinon? You can now support the project via the open collective:
> https://opencollective.com/sinon/donate
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] requires a peer of mocha@^2.4.5 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of webpack@^1.12.13 || ^2.1.0-beta.15 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
added 1076 packages from 1758 contributors in 107.087s
As you can see, that's a lot of things, especially for Windows environments.
Package updated and working: https://zxing-ngx-scanner.stackblitz.io/
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.