Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node-gyp rebuild error while deploying on Azure (No problem with local mac machine) #459

Open
aravindtrue opened this issue Dec 19, 2018 · 4 comments

Comments

@aravindtrue
Copy link

Versions
node v6.9.5
npm v3.10.10

Problem
I've installed the node-java module to implement a functionality, everything worked great on my local mac machine, but I'm getting the below error while deploying it on my Azure instance.

Error

2018-12-19T22:43:55.3094418Z [command]C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files\nodejs\npm.cmd" install --force"
2018-12-19T22:43:55.9427910Z npm WARN using --force I sure hope you know what you are doing.
2018-12-19T22:44:22.5039425Z 
2018-12-19T22:44:22.5040552Z > java@0.11.0 install D:\a\1\s\node_modules\java
2018-12-19T22:44:22.5040612Z > node-gyp rebuild
2018-12-19T22:44:22.5040648Z 
2018-12-19T22:44:22.5555136Z 
2018-12-19T22:44:22.5558971Z D:\a\1\s\node_modules\java>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) 
2018-12-19T22:44:26.5089021Z gyp ERR! configure error 
2018-12-19T22:44:26.5089152Z gyp ERR! stack Error: Command failed: C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
2018-12-19T22:44:26.5089423Z gyp ERR! stack   File "<string>", line 1
2018-12-19T22:44:26.5089459Z gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
2018-12-19T22:44:26.5089491Z gyp ERR! stack                                ^
2018-12-19T22:44:26.5089543Z gyp ERR! stack SyntaxError: invalid syntax
2018-12-19T22:44:26.5089571Z gyp ERR! stack 
2018-12-19T22:44:26.5089602Z gyp ERR! stack     at ChildProcess.exithandler (child_process.js:276:12)
2018-12-19T22:44:26.5089668Z gyp ERR! stack     at emitTwo (events.js:126:13)
2018-12-19T22:44:26.5090330Z gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
2018-12-19T22:44:26.5090391Z gyp ERR! stack     at maybeClose (internal/child_process.js:915:16)
2018-12-19T22:44:26.5090436Z gyp ERR! stack     at Socket.stream.socket.on (internal/child_process.js:336:11)
2018-12-19T22:44:26.5090504Z gyp ERR! stack     at emitOne (events.js:116:13)
2018-12-19T22:44:26.5090554Z gyp ERR! stack     at Socket.emit (events.js:211:7)
2018-12-19T22:44:26.5090598Z gyp ERR! stack     at Pipe._handle.close [as _onclose] (net.js:561:12)
2018-12-19T22:44:26.5094910Z gyp ERR! System Windows_NT 10.0.14393
2018-12-19T22:44:26.5094989Z gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
2018-12-19T22:44:26.5095031Z gyp ERR! cwd D:\a\1\s\node_modules\java
2018-12-19T22:44:26.5095090Z gyp ERR! node -v v8.12.0
2018-12-19T22:44:26.5097596Z gyp ERR! node-gyp -v v3.8.0
2018-12-19T22:44:26.5097626Z gyp ERR! not ok 
2018-12-19T22:44:26.5421930Z 
2018-12-19T22:44:26.5422806Z > java@0.11.0 postinstall D:\a\1\s\node_modules\java
2018-12-19T22:44:26.5423035Z > node postInstall.js
2018-12-19T22:44:26.5423372Z 
2018-12-19T22:44:34.4823410Z fs.js:646
2018-12-19T22:44:34.4824894Z   return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
2018-12-19T22:44:34.4829299Z                  ^
2018-12-19T22:44:34.4829919Z 
2018-12-19T22:44:34.4830635Z Error: ENOENT: no such file or directory, open 'D:\a\1\s\node_modules\java\build\jvm_dll_path.json'
2018-12-19T22:44:34.4830820Z     at Object.fs.openSync (fs.js:646:18)
2018-12-19T22:44:34.4830963Z     at Object.fs.writeFileSync (fs.js:1299:33)
2018-12-19T22:44:34.4831118Z     at D:\a\1\s\node_modules\java\postInstall.js:22:8
2018-12-19T22:44:34.4831257Z     at D:\a\1\s\node_modules\find-java-home\index.js:133:31
2018-12-19T22:44:34.4831393Z     at _combinedTickCallback (internal/process/next_tick.js:132:7)
2018-12-19T22:44:34.4831577Z     at process._tickCallback (internal/process/next_tick.js:181:9)
2018-12-19T22:44:34.4831713Z     at Function.Module.runMain (module.js:696:11)
2018-12-19T22:44:34.4832619Z     at startup (bootstrap_node.js:204:16)
2018-12-19T22:44:34.4832819Z     at bootstrap_node.js:625:3
2018-12-19T22:44:34.6976085Z added 142 packages from 134 contributors and audited 249 packages in 30.737s
2018-12-19T22:44:34.6976240Z found 0 vulnerabilities
2018-12-19T22:44:34.6976264Z 
2018-12-19T22:44:34.7309150Z ##[section]Finishing: npm install

I've also manually tried to do the following and still getting error,

\ [f785c60b*]> npm install -g node-gyp
D:\home\data\monaco\home\npm\node-gyp -> D:\home\data\monaco\home\npm\node_modules\node-gyp\bin\node-gyp.js
D:\home\data\monaco\home\npm
`-- node-gyp@3.8.0 

\ [f785c60b*]> npm install java --msvs_version=2012

> java@0.11.0 install D:\home\site\wwwroot\node_modules\java
> node-gyp rebuild


D:\home\site\wwwroot\node_modules\java>if not defined npm_config_node_gyp (node "D:\Program Files (x86)\npm\3.10.10\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild ) 
[node-java] Error: not found: javac.exe
gyp: Call to 'node findJavaHome.js' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (D:\Program Files (x86)\npm\3.10.10\node_modules\npm\node_modules\node-gyp\lib\configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "D:\\Program Files (x86)\\nodejs\\6.9.5\\node.exe" "D:\\Program Files (x86)\\npm\\3.10.10\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\home\site\wwwroot\node_modules\java
gyp ERR! node -v v6.9.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
�[37;40mnpm �[31;40mERR! Windows_NT 10.0.14393
�[37;40mnpm �[31;40mERR! argv "D:\\Program Files (x86)\\nodejs\\6.9.5\\node.exe" "D:\\Program Files (x86)\\npm\\3.10.10\\node_modules\\npm\\bin\\npm-cli.js" "install" "java" "--msvs_version=2012"
�[37;40mnpm �[31;40mERR! node v6.9.5
�[37;40mnpm �[31;40mERR! npm  v3.10.10
�[37;40mnpm �[31;40mERR! code ELIFECYCLE

�[37;40mnpm �[31;40mERR! java@0.11.0 install: `node-gyp rebuild`
�[37;40mnpm �[31;40mERR! Exit status 1
�[37;40mnpm �[31;40mERR! 
�[37;40mnpm �[31;40mERR! Failed at the java@0.11.0 install script 'node-gyp rebuild'.
�[37;40mnpm �[31;40mERR! Make sure you have the latest version of node.js and npm installed.
�[37;40mnpm �[31;40mERR! If you do, this is most likely a problem with the java package,
�[37;40mnpm �[31;40mERR! not with npm itself.
�[37;40mnpm �[31;40mERR! Tell the author that this fails on your system:
�[37;40mnpm �[31;40mERR!     node-gyp rebuild
�[37;40mnpm �[31;40mERR! You can get information on how to open an issue for this project with:
�[37;40mnpm �[31;40mERR!     npm bugs java
�[37;40mnpm �[31;40mERR! Or if that isn't available, you can get their info via:
�[37;40mnpm �[31;40mERR!     npm owner ls java
�[37;40mnpm �[31;40mERR! There is likely additional logging output above.

�[37;40mnpm �[31;40mERR! Please include the following file with any support request:
�[37;40mnpm �[31;40mERR!     D:\home\site\wwwroot\npm-debug.log
\ [f785c60b*]> 
@aravindtrue
Copy link
Author

Hello,
Any updates on this issue?

@aravindtrue
Copy link
Author

Just noticed a issue,
nodejs/node-gyp#155

I'm using python 2.7.15 and node-gyp rebuild is not working and throwing error. Any help would be much appreciated.

@lukechu10
Copy link

According to the log, it says [node-java] Error: not found: javac.exe. You might have to use the path to your java executable because it is not in %path%

@arsevys
Copy link

arsevys commented Jun 13, 2019

you have two options :
1.- Upload your proyect with the folder node_modules
2.- run custom shell or bash scripts during deployment

you should read this
https://docs.microsoft.com/en-us/azure/nodejs-use-node-modules-azure-apps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants