node-gyp icon indicating copy to clipboard operation
node-gyp copied to clipboard

npm install error/python, firebase

Open doptster opened this issue 8 years ago • 13 comments

I tried running the code in a project that I clone from git. npm install At the first installation, it says 'Can't find Python executable', but I resolved it by installing a python. and executed npm --add-python-to-path='true' --debug install --global windows-build-tools But after that when I tried running again, I got another error:

Traceback (most recent call last): File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 16, in <module> sys.exit(gyp.script_main()) File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 545, in script_main return main(sys.argv[1:]) File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 538, in main return gyp_main(args) File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 523, in gyp_main generator.GenerateOutput(flat_list, targets, data, params) File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 2025, in GenerateOutput version=msvs_version) File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSNew.py", line 213, in __init__ self.Write() File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSNew.py", line 340, in Write f.close() File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\common.py", line 393, in close os.rename(self.tmp_path, filename) WindowsError: **[Error 183] Cannot create a file when that file already exists**

Anyone has a clue to resolve this?

doptster avatar Jun 20 '18 05:06 doptster

Can you post the complete output of npm install?

bnoordhuis avatar Jun 20 '18 16:06 bnoordhuis

`PS C:\Users\USER\Documents\GitHub\hackernews-react-graphql> npm install firebase -D

[email protected] install C:\Users\USER\Documents\GitHub\hackernews-react-graphql\node_modules\grpc node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.10.1/node-v64-win32-x64-unknown.tar.gz node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, unknown) (falling back to source compile with node-gyp) node-pre-gyp ERR! Pre-built binaries not installable for [email protected] and [email protected] (node-v64 ABI, unknown) (falling back to source compile with node-gyp) node-pre-gyp ERR! Hit error Connection closed while downloading tarball file Traceback (most recent call last): File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 16, in sys.exit(gyp.script_main()) File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 545, in script_main return main(sys.argv[1:]) File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 538, in main return gyp_main(args) File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 523, in gyp_main generator.GenerateOutput(flat_list, targets, data, params) File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 2025, in GenerateOutput version=msvs_version) File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSNew.py", line 213, in init self.Write() File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSNew.py", line 340, in Write f.close() File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\common.py", line 393, in close os.rename(self.tmp_path, filename) WindowsError: [Error 183] Cannot create a file when that file already exists gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:336:16) gyp ERR! stack at ChildProcess.emit (events.js:182:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12) gyp ERR! System Windows_NT 10.0.16299 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=C:\Users\USER\Documents\GitHub\hackernews-react-graphql\node_modules\grpc\src\node\extension_binary\node-v64-win32-x64-unknown\grpc_node.node" "--module_name=grpc_node" "--module_path=C:\Users\USER\Documents\GitHub\hackernews-react-graphql\node_modules\grpc\src\node\extension_binary\node-v64-win32-x64-unknown" "--python=C:\Users\USER\AppData\Local\Programs\Python\Python36\python.exe" "--msvs_version=2015" gyp ERR! cwd C:\Users\USER\Documents\GitHub\hackernews-react-graphql\node_modules\grpc gyp ERR! node -v v10.3.0 gyp ERR! node-gyp -v v3.6.2 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_library --module=C:\Users\USER\Documents\GitHub\hackernews-react-graphql\node_modules\grpc\src\node\extension_binary\node-v64-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\Users\USER\Documents\GitHub\hackernews-react-graphql\node_modules\grpc\src\node\extension_binary\node-v64-win32-x64-unknown --python=C:\Users\USER\AppData\Local\Programs\Python\Python36\python.exe --msvs_version=2015' (1) node-pre-gyp ERR! stack at ChildProcess. (C:\Users\USER\Documents\GitHub\hackernews-react-graphql\node_modules\grpc\node_modules\node-pre-gyp\lib\util\compile.js:83:29) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:961:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5) node-pre-gyp ERR! System Windows_NT 10.0.16299 node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\USER\Documents\GitHub\hackernews-react-graphql\node_modules\grpc\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build" "--library=static_library" node-pre-gyp ERR! cwd C:\Users\USER\Documents\GitHub\hackernews-react-graphql\node_modules\grpc node-pre-gyp ERR! node -v v10.3.0 node-pre-gyp ERR! node-pre-gyp -v v0.7.0 node-pre-gyp ERR! not ok Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_library --module=C:\Users\USER\Documents\GitHub\hackernews-react-graphql\node_modules\grpc\src\node\extension_binary\node-v64-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\Users\USER\Documents\GitHub\hackernews-react-graphql\node_modules\grpc\src\node\extension_binary\node-v64-win32-x64-unknown --python=C:\Users\USER\AppData\Local\Programs\Python\Python36\python.exe --msvs_version=2015' (1) npm WARN [email protected] requires a peer of react@^0.13.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of react@^0.14.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of react-addons-test-utils@^0.14.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of react-dom@^0.14.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of react@^15.5.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of react-dom@^15.5.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of react-test-renderer@^15.5.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of [email protected] - 15.4.x but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of [email protected] - 15.4.x but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of [email protected] - 15.4.x but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of eslint-plugin-jsx-a11y@^5.1.1 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] No repository field. 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-pre-gyp install --fallback-to-build --library=static_library 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.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\USER\AppData\Roaming\npm-cache_logs\2018-06-20T04_53_23_183Z-debug.log 2018-06-20T04_53_23_183Z-debug.log `

doptster avatar Jun 21 '18 03:06 doptster

I got the same error when executing npm install and npm install firebase

doptster avatar Jun 21 '18 03:06 doptster

Some observations:

  • --python=C:\Users\USER\AppData\Local\Programs\Python\Python36\python.exe" gyp is not compatible with Python 3 and requires Python 2.
  • [email protected] It looks like the first version of grpc that supports Node.js 10 is v1.11.1 (https://github.com/grpc/grpc-node/pull/302). firebase would need to update the version of grpc it uses: https://github.com/firebase/firebase-js-sdk/issues/912

richardlau avatar Jun 21 '18 05:06 richardlau

--python=C:\Users\USER\AppData\Local\Programs\Python\Python36\python.exe" gyp is not compatible with Python 3 and requires Python 2.

Solved by npm config set python "c:\Python\27\python.exe", thanks for that.

[email protected]

I am not entirely sure what to do here.. is it by installing later version of firebase? in the package.json is "firebase": "^4.3.1",

UPDATED: I installed the latest firebase to solve the problem, it's working now! Thanks for the references. npm install firebase@latest

doptster avatar Jun 21 '18 09:06 doptster

Newer firebase versions also have this problem...(currently 5.5.9). What version worked for you?

LiteSoul avatar Nov 21 '18 13:11 LiteSoul

Newer firebase versions also have this problem...(currently 5.5.9). What version worked for you?

Having the same issue.

SeanSassenrath avatar Nov 21 '18 15:11 SeanSassenrath

Having same issue with firebase. npm i firebase@latest didn't work for me (And ofc. yarn didn't work either)

Got a 404 on:

Tried to download(404): https://node-precompiled-binaries.grpc.io/grpc/v1.16.0/node-v67-linux-x64-glibc.tar.gz

Node 11.1.0 Node-gyp 3.8.0

Bastardly avatar Nov 26 '18 18:11 Bastardly

@Bastardly That is a firebase/grpc issue, not a node-gyp issue. Firebase need to update their dependencies to be compatible with Node.js 11: https://github.com/firebase/firebase-js-sdk/pull/1394

richardlau avatar Nov 26 '18 18:11 richardlau

What @richardlau says is correct. I used NVM to downgrade my node version to 10.13.0 and now everything works with installing the firebase@latest package.

tamitutor avatar Nov 27 '18 04:11 tamitutor

@richardlau You are right ofc. :)

Bastardly avatar Nov 27 '18 15:11 Bastardly

I was gone through same problem solved after lot efforts. It is because of npm version is not compatible with gprc version. So we need to update the npm.

1 - npm update 2 - npm install

this solve my issue. Thank you

vishalchavanvicky avatar Aug 12 '19 11:08 vishalchavanvicky

All needed was an update of NPM. I was horribly behind. For windows people save yourself some additional headache & searching: https://github.com/felixrieseberg/npm-windows-upgrade

kantmichel avatar Apr 02 '21 07:04 kantmichel