Forum Stats

  • 3,751,824 Users
  • 2,250,415 Discussions
  • 7,867,600 Comments

Discussions

Installing node-oracledb on Microsoft Windows

Christopher Jones-Oracle
Christopher Jones-Oracle Member Posts: 1,638 Employee
edited Mar 7, 2018 12:27AM in Node.js

Installing node-oracledb on Microsoft Windows

Bill Christo

In this article Bill Christo (@bchr02) leads you step-by-step though the process of installing node-oracledb on Microsoft Windows. Bill is an experienced corporate solutions provider and full-stack developer. He has been using the node-oracledb driver since it was released. He has contributed to it, and has guided many users through the process of installation on Windows.

Note: This article is for node-oracledb v1 and is outdated.  Node-oracledb v2 has pre-built binaries and installation is much simpler.  See https://oracle.github.io/node-oracledb/INSTALL.html

I. Introduction

Node.js has revolutionized the web development industry by facilitating the use of the JavaScript programming language for server-side development. This also brings with it JavaScript’s non-blocking architecture, which permits commands to be executed in parallel in a single thread, allowing for the construction of highly concurrent applications. Before Node.js, developers were forced to use other languages such as PHP or ASP on the server-side, in addition to using JavaScript on the client-side. Having the ability for a more unified API opens the doors for increased efficiency and the potential of code sharing between the client and server.

Many companies have realized how advantageous Node.js is and so they are doing what they can to support it. One of the most recent companies to do this is Oracle Corp. with their release of node-oracledb, an Oracle database driver for Node.js. Node-oracledb is an open source project being actively maintained by Oracle on GitHub at the following URL: https://github.com/oracle/node-oracledb

In this article, we will cover what is needed to get node-oracledb installed and working on Microsoft Windows. This article is geared to those who have an Oracle database in their environment and those who are familiar with using Node.js and the npm package manager. If you are not yet familiar with them you should first familiarize yourself before proceeding. There are many websites to help you get started. One such website is nodeschool.io.

II. Before You Begin

Before you begin the installation, there are several factors to consider. First, you need to know the bitness of your Windows Operating System. Is it 32-bit or 64-bit? If 32-bit, you must use 32-bit software throughout the rest of the process. If 64-bit, you have the option of either. What’s important is that you remain consistent with the same bitness for all the software that is required. Mismatched usage of 32-bit and 64-bit software won’t work and instead would give ambiguous error messages during node-oracledb’s compilation.

In this article we will be using Visual Studio Community 2013 and Oracle Instant Client 12c, however, if you plan to use another version of either package, you need to verify that they are compatible with one another. For example, you cannot use Visual Studio 2008 with Oracle Database Client 12c because Oracle Database Client 12c does not contain the necessary files to compile with that version of Visual Studio. You would instead have to use Oracle Instant Client 11g. But, how would you know that? You would know that by reading the Client Quick Installation Guide for that version of Oracle, which clearly specify the supported compilers.

As an example, if we pull up the Oracle Instant Client 12.1 Quick Installation Guide for x64 Windows, under Section 3 we can see that version 2013 of Visual Studio is compatible.

1.jpg

By the way, you shouldn’t have any issues using a newer Oracle client from the Oracle database you are connecting to so long as it’s not too much older. For example, connecting to a 10gR2 database from a 12c client has never caused any issues for me. If you have a valid Oracle Support ID you can see Metalink Note 207303.1 for more information on backwards compatibility.

III. Install the Prerequisites

a. Visual Studio 2013 Community Edition

Before we can install node-oracledb we will need to install the prerequisites. We will start by installing Visual Studio 2013 Community Edition. At the time of this article, this can be downloaded from the Downloads section of the Visual Studio website here: https://www.visualstudio.com/downloads.

1.  Once at the site, scroll down until you see “Visual Studio 2013” and once found, click on it. This will bring you to the following page:
2.jpg

2.  Next, you will want to click on “Download” to download the Visual Studio Community 2013 with Update 5 web installer.

3.  Once downloaded, run it.


4.  At the first screen of the installation, you have the option to change the install location. Click Next.

5.  At the next screen, you will need to agree to the licensing terms.

6.  At the optional features screen, you can safely uncheck each of them because none of them are necessary to proceed. Finally, click “Install”.

3.jpg

7. The installation time usually takes at least 20 minutes but can easily take much longer depending on your download speeds and what dependencies it finds that it needs to install for your specific system. Once the installation finishes you can just click the “x” on the top right to close it.

4.jpg

b. Python 2.7

Next, we need to install Python from the Python.org website’s Python 2.7 Download page.

      Here is a direct link: https://www.python.org/downloads/release/python-2710/

1.  Once at the page, you will want to either download the file named “Windows x86-64 MSI installer” or “Windows x86 MSI installer” depending on whether you are doing a 32-bit or 64-bit installation. The file marked x86-64 is for 64-bit installations. Once you have downloaded the file run it. On the first screen of the installation you will be asked whether you want to install for for all users or not. You can leave this set to the default and click “Next”.

5.jpg

  2. On the second screen you will be asked for the destination directory. You can leave this set to the default and click “Next”.

6.jpg

3.  On the third screen of the installation you will be asked to customize the installation. At this screen it’s important that you scroll down to where it says “Add python.exe to Path” and select to include it with the installation. Then click “Next”. Once the installation finishes click “Finish”.

7.jpg

c. Node.js

The next prerequisite to install is a compatible version of Node.js. Be sure to check node-oracle’s README.md for a currently supported version. In this article I will be using version 0.12.7, which is available from one of the following two links.

For 32-bit: https://nodejs.org/dist/v0.12.7/node-v0.12.7-x86.msi

For 64-bit: https://nodejs.org/dist/v0.12.7/x64/node-v0.12.7-x64.msi

1.  Once the msi installer is downloaded run it.

2.  At the first screen of the installation, click “Next”.

8.jpg

3.  Accept the licensing agreement and click “Next”.
  9.jpg

4.  Choose the installation directory or leave at the default location, then click “Next”

10.jpg

5.  At the Custom Setup page, be sure that “Add to Path” is selected, then click “Next”. And then at the “Ready to install” page click “Install”.

11.jpg

d. Oracle Instant Client Downloads

Next, we will download the necessary Oracle Client files from the following URL: http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html

1.  Once at the Oracle Instant Client Downloads page, for 64-bit installations click “Instant Client for Microsoft Windows (x64)” or for 32-bit choose “Instant Client for Microsoft Windows (32-bit)”.
12.jpg

2.  At the top of the next page you will first need to accept the license agreement. Then click to download each of the following two files:

    • Instant Client Package – Basic
    • Instant Client Package – SDK

    You will need a free Oracle Account to download the above two files. (If you don’t have one, create one and then go back to download.)

    3.  Once the two zip files are downloaded, we need to extract them. Right click on the first zip file and choose “Extract All” then click “Extract”. Do the same for the second zip file. Once both are extracted, create a new folder named “Oracle” on the root directory. Then within that folder, create another folder named “instantclient”. Now we need to copy the contents of each of the extracted folder’s sub folder into this new folder. After you do this, c:\Oracle\instantclient should look something like this:

    13.jpg

    IV. Set Environment Variables

    The last steps we will need to do before we can install node-oracledb is to add the dynamic link libraries (DLLs), the ones we copied to c:\Oracle\instantclient, to the PATH environment variable and make sure they appear first. You should always make sure they appear first in the event you have another Oracle folder already in PATH, from perhaps an old install. The DLLs that node-oracledb finds first are the ones that it uses. Also we need to add the OCI_LIB_DIR and OCI_INC_DIR environment variables. These are only required during the installation of node-oracledb so that it can compile.

    1.  Open the System window by ONE of the following two methods:

      • Using your mouse, click on the “Start Menu” then right click “Computer” and choose “Properties”.
        • On your keyboard press Win + Pause/Break

        2.  Click on “Advanced system settings” which is located on the left side of the window. This will bring up the System Properties dialog box.

        3.  Click on the Environment Variables button.

        4. Once at the Environment Variables window, you will want to search the System Variables list (located on the bottom half of the window) for Path. Once found click on it and then click “Edit”.

        5.  Add “C:\Oracle\instantclient;” to the beginning of the Variable value field (as shown below).

        14.jpg

        6.  Click “OK” to save.

        7.  Next, under the System variable sections, click “New”.

        8.  Add “OCI_LIB_DIR” as the variable name.

        9.  Add “C:\Oracle\instantclient\sdk\lib\msvc” as the variable value.

        15.jpg

        10.  Click “OK” to save.

        11.  Next, under the System variable sections, click “New”

        12.  Add “OCI_INC_DIR” as the variable name.

        13.  Add “C:\Oracle\instantclient\sdk\include” as the variable value.

        16.jpg

        14.  Click “OK” to save.

        15.  Click “OK” on the following two windows to finish saving and closing the dialog boxes.

        V. Install node-oracledb

        Now we are finally ready to install the module.

        1. Create a folder where your node app will reside.
        2. Open a new command prompt and navigate to this folder. (Make sure that you don’t use an existing command prompt that was open before you set and updated the environment variables because they won’t be available to it.)
        3. Type: npm install oracledb

        TIP: If you are sitting behind a firewall you may need to configure npm to route your requests through a proxy using the following command:

        npm config set https-proxy http://www.example.com:80/

        If successful, your results should look similar to the below:

        17.jpg

        VI. Test

        To test that oracledb is working, copy the below code in a new file named app.js, which you are to save within the node app directory created in the last section.

        // app.jsvar oracledb = require('oracledb');oracledb.getConnection({     user: "hr",     password: "welcome",     connectString: "localhost/xe"}, function(err, connection) {     if (err) {          console.error(err.message);          return;     }     connection.execute( "SELECT department_id, department_name FROM departments WHERE department_id = 180",     [],     function(err, result) {          if (err) {               console.error(err.message);               doRelease(connection);               return;          }          console.log(result.metaData);          console.log(result.rows);          doRelease(connection);     });});function doRelease(connection) {     connection.release(          function(err) {               if (err) {console.error(err.message);}          }     );}    

        Now modify the user, password, connectString, and query to match your environment. However, if you have unlocked and set the password for the HR sample account... for example:

        ALTER USER HR ACCOUNT UNLOCK IDENTIFIED BY welcome;   

        ...and would like to test using the Oracle supplied sample database, then you only need to change the password and possibly the connectString (if your database resides on another computer).

        After having saved the above code to a file named app.js within the node app directory created in the last section, we can run it.

        1. open a command prompt and navigate to app directory
        2. type node app.js

        If successful, you should now have the results of the query displayed in your command prompt as JSON. If you have used the HR sample database you results should look like this:

        18.jpg

        VII. Copying Binaries Between Windows Machines

        Now that we installed and tested node-oracledb, you might find it useful to know that you could copy the install to another computer. This saves you the trouble of needing to install Visual Studios and Python on the destination computer.

        Instructions

        1. Both computers must have the same version and architecture of Node.js.

        2. Both computers must have the same version and architecture of the Oracle Client Libraries (Instant Client Package – Basic). The same instructions from Section III. d. can be used. The SDK (Instant Client Package – SDK) is not needed but it wouldn’t hurt to have it in the event you later decided to install a build environment.

        3. The Oracle Client Libraries must be in the destination computer's PATH environment variable. The same instructions as in Section IV. can be used.

        4. On the source computer after node-oracle has been built, copy the node_modules\oracledb directory to the destination computer's node_module directory.

        5. If you used Oracle Client 11.2 then the Visual Studio 2005 restributable is required. For Oracle Client 12.1, use the Visual Studio 2010 redistributable. Also, be sure to use the same architecture as the Oracle Client Libraries that you have installed.

        It should be mentioned that while copying the installation may be useful for quickly setting up a development computer, I do not recommend it for a production deployment. The reason is because using this method does not allow the destination computer to upgrade node-oracledb when newer versions come out. Additionally, upgrading to a newer version of Node.js could break the node-oracledb installation. For security reasons, production deployments should try to have the most up to date Node.js installed.

        VIII. Conclusion

        In this article I have shown you how to install node-oracledb for Node.js on Microsoft Windows. Within Node.js, using only JavaScript, we have set up an environment that can connect and interface with an Oracle database. I have also shown you how easy it is to copy and use the binaries on another computer. From here, with npm (node package manager) you could install another module, such as Express (https://www.npmjs.com/package/express) or LoopBack (https://github.com/strongloop/loopback/), and build single page applications, websites or HTTP API’s. The possibilities are endless!

        About the Author

        Bill Christo (@bchr02) is an experienced corporate solutions provider and full-stack developer. For over a decade he has worked as the IT Manager for several small aerospace based businesses in South Florida. Bill is passionate in creating technological efficiencies that allows companies to become more successful through the use of better processes and tools. He is also passionate about Information Security. Bill holds a Bachelor of Science in Information Technology from Western Governors University. He also holds the following Certifications: Microsoft Certified Systems Administrator, CompTIA Linux+, CompTIA Security+, CompTIA Project+, Sun Certified Java Associate, CIW JavaScript Specialist, CIW Web Design Specialist, and CIW Professional. https://www.linkedin.com/in/billchristo or https://twitter.com/bchr02

        «13

        Comments

        • Mutyala Rao
          Mutyala Rao Member Posts: 3
          edited Jan 1, 2016 8:01AM

          Hi,

          I am done with installing the prerequisites but while running the npm, I am facing the below error. Could you please help?

          Building the projects in this solution one at a time. To enable parallel build

          please add the "/m" switch.

          C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.

          argets(44,5): error MSB8020: The builds tools for v120 (Platform Toolset = 'v1

          0') cannot be found. To build using the v120 build tools, either click the Pro

          ect menu or right-click the solution, and then select "Update VC++ Projects...

          . Install v120 to build using the v120 build tools. [C:\Users\Rao\AppData\Ro

          ming\npm\node_modules\oracledb\build\oracledb.vcxproj]

          gyp ERR! build error

          gyp ERR! stack Error: `msbuild` failed with exit code: 1

          gyp ERR! stack     at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_

          dules\npm\node_modules\node-gyp\lib\build.js:269:23)

          gyp ERR! stack     at ChildProcess.emit (events.js:110:17)

          gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:10

          :12)

          gyp ERR! System Windows_NT 6.1.7601

          gyp ERR! command "node" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\n

          e_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"

          gyp ERR! cwd C:\Users\Rao\AppData\Roaming\npm\node_modules\oracledb

          gyp ERR! node -v v0.12.7

          gyp ERR! node-gyp -v v2.0.1

          gyp ERR! not ok

          npm ERR! Windows_NT 6.1.7601

          npm ERR! argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files

          x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "oracledb" "-g"

          npm ERR! node v0.12.7

          npm ERR! npm  v2.11.3

          npm ERR! code ELIFECYCLE

          npm ERR! [email protected] install: `node-gyp rebuild`

          npm ERR! Exit status 1

          npm ERR!

          npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.

          npm ERR! This is most likely a problem with the oracledb package,

          npm ERR! not with npm itself.

          npm ERR! Tell the author that this fails on your system:

          npm ERR!     node-gyp rebuild

          npm ERR! You can get their info via:

          npm ERR!     npm owner ls oracledb

          npm ERR! There is likely additional logging output above.

          npm ERR! Please include the following file with any support request:

          npm ERR!     C:\Users\Rao\npm-debug.log

          ****UPDATE: SOLVED!! *****

          Issue fixed after doing below steps. Thanks to Pomodory and his links!

          1) Add a user variable "ToolPath" as "C:\Program Files (x86)\MSBuild\12.0\Bin". I think this is required. No matter what I install this did not get added to PATH automatically.

          2) Add a user variable "GYP_MSVS_VERSION" as 2013

          3) Add the path "C:\Program Files (x86)\MSBuild\12.0\Bin" to PATH variable.

        • Pomodory
          Pomodory Member Posts: 1
          edited Dec 31, 2015 4:14AM

          Hi,

          I am done with installing the prerequisites but while running the npm, I am facing the below error. Could you please help?

          Building the projects in this solution one at a time. To enable parallel build

          please add the "/m" switch.

          C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.

          argets(44,5): error MSB8020: The builds tools for v120 (Platform Toolset = 'v1

          0') cannot be found. To build using the v120 build tools, either click the Pro

          ect menu or right-click the solution, and then select "Update VC++ Projects...

          . Install v120 to build using the v120 build tools. [C:\Users\Rao\AppData\Ro

          ming\npm\node_modules\oracledb\build\oracledb.vcxproj]

          gyp ERR! build error

          gyp ERR! stack Error: `msbuild` failed with exit code: 1

          gyp ERR! stack     at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_

          dules\npm\node_modules\node-gyp\lib\build.js:269:23)

          gyp ERR! stack     at ChildProcess.emit (events.js:110:17)

          gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:10

          :12)

          gyp ERR! System Windows_NT 6.1.7601

          gyp ERR! command "node" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\n

          e_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"

          gyp ERR! cwd C:\Users\Rao\AppData\Roaming\npm\node_modules\oracledb

          gyp ERR! node -v v0.12.7

          gyp ERR! node-gyp -v v2.0.1

          gyp ERR! not ok

          npm ERR! Windows_NT 6.1.7601

          npm ERR! argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files

          x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "oracledb" "-g"

          npm ERR! node v0.12.7

          npm ERR! npm  v2.11.3

          npm ERR! code ELIFECYCLE

          npm ERR! [email protected] install: `node-gyp rebuild`

          npm ERR! Exit status 1

          npm ERR!

          npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.

          npm ERR! This is most likely a problem with the oracledb package,

          npm ERR! not with npm itself.

          npm ERR! Tell the author that this fails on your system:

          npm ERR!     node-gyp rebuild

          npm ERR! You can get their info via:

          npm ERR!     npm owner ls oracledb

          npm ERR! There is likely additional logging output above.

          npm ERR! Please include the following file with any support request:

          npm ERR!     C:\Users\Rao\npm-debug.log

          ****UPDATE: SOLVED!! *****

          Issue fixed after doing below steps. Thanks to Pomodory and his links!

          1) Add a user variable "ToolPath" as "C:\Program Files (x86)\MSBuild\12.0\Bin". I think this is required. No matter what I install this did not get added to PATH automatically.

          2) Add a user variable "GYP_MSVS_VERSION" as 2013

          3) Add the path "C:\Program Files (x86)\MSBuild\12.0\Bin" to PATH variable.

          ****** Moderator @CKPT edited ********************

          I just solved this problem yesterday.

          I install vs2015 in my computer, so it can't find the v102 which is belong vs2013.

          just run

               npm install --msvs_version=2015

          here are two links which solve my problem:

               http://stackoverflow.com/questions/32556295/npm-install-error-the-build-tools-for-v120-platform-toolset-v120-cannot

               https://github.com/nodejs/node-gyp/issues/679

          oh!are you use vs2012?

               so you should run npm install --msvs_version=2012

          just try

          coalesce
        • bchr02
          bchr02 Member Posts: 4

          Hi,

          I am done with installing the prerequisites but while running the npm, I am facing the below error. Could you please help?

          Building the projects in this solution one at a time. To enable parallel build

          please add the "/m" switch.

          C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.

          argets(44,5): error MSB8020: The builds tools for v120 (Platform Toolset = 'v1

          0') cannot be found. To build using the v120 build tools, either click the Pro

          ect menu or right-click the solution, and then select "Update VC++ Projects...

          . Install v120 to build using the v120 build tools. [C:\Users\Rao\AppData\Ro

          ming\npm\node_modules\oracledb\build\oracledb.vcxproj]

          gyp ERR! build error

          gyp ERR! stack Error: `msbuild` failed with exit code: 1

          gyp ERR! stack     at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_

          dules\npm\node_modules\node-gyp\lib\build.js:269:23)

          gyp ERR! stack     at ChildProcess.emit (events.js:110:17)

          gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:10

          :12)

          gyp ERR! System Windows_NT 6.1.7601

          gyp ERR! command "node" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\n

          e_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"

          gyp ERR! cwd C:\Users\Rao\AppData\Roaming\npm\node_modules\oracledb

          gyp ERR! node -v v0.12.7

          gyp ERR! node-gyp -v v2.0.1

          gyp ERR! not ok

          npm ERR! Windows_NT 6.1.7601

          npm ERR! argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files

          x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "oracledb" "-g"

          npm ERR! node v0.12.7

          npm ERR! npm  v2.11.3

          npm ERR! code ELIFECYCLE

          npm ERR! [email protected] install: `node-gyp rebuild`

          npm ERR! Exit status 1

          npm ERR!

          npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.

          npm ERR! This is most likely a problem with the oracledb package,

          npm ERR! not with npm itself.

          npm ERR! Tell the author that this fails on your system:

          npm ERR!     node-gyp rebuild

          npm ERR! You can get their info via:

          npm ERR!     npm owner ls oracledb

          npm ERR! There is likely additional logging output above.

          npm ERR! Please include the following file with any support request:

          npm ERR!     C:\Users\Rao\npm-debug.log

          ****UPDATE: SOLVED!! *****

          Issue fixed after doing below steps. Thanks to Pomodory and his links!

          1) Add a user variable "ToolPath" as "C:\Program Files (x86)\MSBuild\12.0\Bin". I think this is required. No matter what I install this did not get added to PATH automatically.

          2) Add a user variable "GYP_MSVS_VERSION" as 2013

          3) Add the path "C:\Program Files (x86)\MSBuild\12.0\Bin" to PATH variable.

          Make sure your nodejs and oracle client libraries are the same bitness (64 or 32).

        • bchr02
          bchr02 Member Posts: 4

          ****** Moderator @CKPT edited ********************

          I just solved this problem yesterday.

          I install vs2015 in my computer, so it can't find the v102 which is belong vs2013.

          just run

               npm install --msvs_version=2015

          here are two links which solve my problem:

               http://stackoverflow.com/questions/32556295/npm-install-error-the-build-tools-for-v120-platform-toolset-v120-cannot

               https://github.com/nodejs/node-gyp/issues/679

          oh!are you use vs2012?

               so you should run npm install --msvs_version=2012

          just try

          @Pomodory, when you installed VS2015, did you choose "Custom Install" and then select Visual C++" option? I am trying to figure out under what scenario one would need to use --msvs_version=2015 because when I installed VS2015 and selected Visual C++ option, I did not need to use that flag.

          Thanks.

        • Mutyala Rao
          Mutyala Rao Member Posts: 3
          edited Jan 1, 2016 8:30AM

          Make sure your nodejs and oracle client libraries are the same bitness (64 or 32).

          Hi,

          I have reinstalled node v4.x 64-bit. But I am getting the below error of msbuild not found. Totally lost on what to install!! Tried visual studio 13, windows build tool, vc redist etc but no luck. In my earlier post the msbuild worked because I have deliberately add the path C:\Windows\Microsoft.NET\Framework64\v4.0.30319

          The error I am facing:

          D:\dev>npm install oracledb

          -

          > [email protected] install D:\dev\node_modules\oracledb

          > node-gyp rebuild

          D:\dev\node_modules\oracledb>if not defined npm_config_node_gyp (node "C:\Progra

          m Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bi

          n\node-gyp.js" rebuild )  else (node  rebuild )

          gyp ERR! build error

          gyp ERR! stack Error: Can't find "msbuild.exe". Do you have Microsoft Visual Stu

          dio C++ 2008+ installed?

          gyp ERR! stack     at findMsbuild (C:\Program Files\nodejs\node_modules\npm\node

          _modules\node-gyp\lib\build.js:122:23)

          gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node

          -gyp\lib\build.js:104:11

          gyp ERR! stack     at F (C:\Program Files\nodejs\node_modules\npm\node_modules\w

          hich\which.js:78:16)

          gyp ERR! stack     at E (C:\Program Files\nodejs\node_modules\npm\node_modules\w

          hich\which.js:82:29)

          gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\whic

          h\which.js:93:16

          gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:82:15)

          gyp ERR! System Windows_NT 6.1.7601

          gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodej

          s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"

          gyp ERR! cwd D:\dev\node_modules\oracledb

          gyp ERR! node -v v4.2.4

          gyp ERR! node-gyp -v v3.0.3

          gyp ERR! not ok

          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" "install" "oracledb"

          npm ERR! node v4.2.4

          npm ERR! npm  v2.14.12

          npm ERR! code ELIFECYCLE

          npm ERR! [email protected] install: `node-gyp rebuild`

          npm ERR! Exit status 1

        • bchr02
          bchr02 Member Posts: 4

          Hi,

          I have reinstalled node v4.x 64-bit. But I am getting the below error of msbuild not found. Totally lost on what to install!! Tried visual studio 13, windows build tool, vc redist etc but no luck. In my earlier post the msbuild worked because I have deliberately add the path C:\Windows\Microsoft.NET\Framework64\v4.0.30319

          The error I am facing:

          D:\dev>npm install oracledb

          -

          > [email protected] install D:\dev\node_modules\oracledb

          > node-gyp rebuild

          D:\dev\node_modules\oracledb>if not defined npm_config_node_gyp (node "C:\Progra

          m Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bi

          n\node-gyp.js" rebuild )  else (node  rebuild )

          gyp ERR! build error

          gyp ERR! stack Error: Can't find "msbuild.exe". Do you have Microsoft Visual Stu

          dio C++ 2008+ installed?

          gyp ERR! stack     at findMsbuild (C:\Program Files\nodejs\node_modules\npm\node

          _modules\node-gyp\lib\build.js:122:23)

          gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node

          -gyp\lib\build.js:104:11

          gyp ERR! stack     at F (C:\Program Files\nodejs\node_modules\npm\node_modules\w

          hich\which.js:78:16)

          gyp ERR! stack     at E (C:\Program Files\nodejs\node_modules\npm\node_modules\w

          hich\which.js:82:29)

          gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\whic

          h\which.js:93:16

          gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:82:15)

          gyp ERR! System Windows_NT 6.1.7601

          gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodej

          s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"

          gyp ERR! cwd D:\dev\node_modules\oracledb

          gyp ERR! node -v v4.2.4

          gyp ERR! node-gyp -v v3.0.3

          gyp ERR! not ok

          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" "install" "oracledb"

          npm ERR! node v4.2.4

          npm ERR! npm  v2.14.12

          npm ERR! code ELIFECYCLE

          npm ERR! [email protected] install: `node-gyp rebuild`

          npm ERR! Exit status 1

          @Mutyala Rao have you tried @Pomodory suggestion? Try: npm install --msvs_version=2013 oracledb

          msvs_version needs to equal the version you currently have installed.

        • Hi,

          I have reinstalled node v4.x 64-bit. But I am getting the below error of msbuild not found. Totally lost on what to install!! Tried visual studio 13, windows build tool, vc redist etc but no luck. In my earlier post the msbuild worked because I have deliberately add the path C:\Windows\Microsoft.NET\Framework64\v4.0.30319

          The error I am facing:

          D:\dev>npm install oracledb

          -

          > [email protected] install D:\dev\node_modules\oracledb

          > node-gyp rebuild

          D:\dev\node_modules\oracledb>if not defined npm_config_node_gyp (node "C:\Progra

          m Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bi

          n\node-gyp.js" rebuild )  else (node  rebuild )

          gyp ERR! build error

          gyp ERR! stack Error: Can't find "msbuild.exe". Do you have Microsoft Visual Stu

          dio C++ 2008+ installed?

          gyp ERR! stack     at findMsbuild (C:\Program Files\nodejs\node_modules\npm\node

          _modules\node-gyp\lib\build.js:122:23)

          gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node

          -gyp\lib\build.js:104:11

          gyp ERR! stack     at F (C:\Program Files\nodejs\node_modules\npm\node_modules\w

          hich\which.js:78:16)

          gyp ERR! stack     at E (C:\Program Files\nodejs\node_modules\npm\node_modules\w

          hich\which.js:82:29)

          gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\whic

          h\which.js:93:16

          gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:82:15)

          gyp ERR! System Windows_NT 6.1.7601

          gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodej

          s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"

          gyp ERR! cwd D:\dev\node_modules\oracledb

          gyp ERR! node -v v4.2.4

          gyp ERR! node-gyp -v v3.0.3

          gyp ERR! not ok

          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" "install" "oracledb"

          npm ERR! node v4.2.4

          npm ERR! npm  v2.14.12

          npm ERR! code ELIFECYCLE

          npm ERR! [email protected] install: `node-gyp rebuild`

          npm ERR! Exit status 1

          Issue fixed after doing below steps. Thanks to Pomodory and his links!

          1) Add a user variable "ToolPath" as "C:\Program Files (x86)\MSBuild\12.0\Bin"

          2) Add a user variable "GYP_MSVS_VERSION" as 2013

          3) Add the path "C:\Program Files (x86)\MSBuild\12.0\Bin" to PATH variable.

        • Thank you very much for this step by step tutorial! very detailed and well explained !

        • Hi,

          I am facing issue while installing node oracle driver on my machine. Here are the environment details -
          Visual Studio - Community version with update 5
          Python - 2.7.10
          Node - 4.2.4 (64 bit)
          Oracle Client - 12.1.0.2.0 (64 bit)
          System - Windows 7

          Here is the log on console -

          TRACKER : error TRK0002: Failed to execute command: ""C:\Program Files (x86)\Mi
          crosoft Visual Studio 12.0\VC\bin\amd64\CL.exe" @C:\Users\shahsv\AppData\Local\
          Temp\tmp905df070b22245508a85dfe54e2da789.rsp". The parameter is incorrect. [C:\
          Users\shahsv\Desktop\node app\node_modules\oracledb\build\oracledb.vcxproj]

          gyp ERR! build error
          gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe fail
          ed with exit code: 1
          gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\
          npm\node_modules\node-gyp\lib\build.js:270:23)
          gyp ERR! stack at emitTwo (events.js:87:13)
          gyp ERR! stack at ChildProcess.emit (events.js:172:7)
          gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_proces
          s.js:200:12)
          gyp ERR! System Windows_NT 6.1.7601
          gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodej
          s\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
          gyp ERR! cwd C:\Users\shahsv\Desktop\node app\node_modules\oracledb
          gyp ERR! node -v v4.2.4
          gyp ERR! node-gyp -v v3.0.3
          gyp ERR! not ok
          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" "install" "oracledb"
          npm ERR! node v4.2.4
          npm ERR! npm v2.14.12
          npm ERR! code ELIFECYCLE

          npm ERR! [email protected] install: node-gyp rebuild
          npm ERR! Exit status 1
          npm ERR!
          npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
          npm ERR! This is most likely a problem with the oracledb package,
          npm ERR! not with npm itself.
          npm ERR! Tell the author that this fails on your system:
          npm ERR! node-gyp rebuild
          npm ERR! You can get their info via:
          npm ERR! npm owner ls oracledb
          npm ERR! There is likely additional logging output above.

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

          Also, here is the debug log -

          408 info [email protected] Failed to exec install script
          409 verbose unlock done using C:\Users\shahsv\AppData\Roaming\npm-cache_locks\oracledb-da25b9573ba09cd6.lock for C:\Users\shahsv\Desktop\node app\node_modules\oracledb
          410 verbose stack Error: [email protected] install: node-gyp rebuild
          410 verbose stack Exit status 1
          410 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:214:16)
          410 verbose stack at emitTwo (events.js:87:13)
          410 verbose stack at EventEmitter.emit (events.js:172:7)
          410 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
          410 verbose stack at emitTwo (events.js:87:13)
          410 verbose stack at ChildProcess.emit (events.js:172:7)
          410 verbose stack at maybeClose (internal/child_process.js:818:16)
          410 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
          411 verbose pkgid [email protected]
          412 verbose cwd C:\Users\shahsv\Desktop\node app
          413 error Windows_NT 6.1.7601
          414 error argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "oracledb"
          415 error node v4.2.4
          416 error npm v2.14.12
          417 error code ELIFECYCLE
          418 error [email protected] install: node-gyp rebuild
          418 error Exit status 1
          419 error Failed at the [email protected] install script 'node-gyp rebuild'.
          419 error This is most likely a problem with the oracledb package,

          Anyone experienced the same problem? Any resolution to it?

        • coalesce
          coalesce Member Posts: 1

          ****** Moderator @CKPT edited ********************

          I just solved this problem yesterday.

          I install vs2015 in my computer, so it can't find the v102 which is belong vs2013.

          just run

               npm install --msvs_version=2015

          here are two links which solve my problem:

               http://stackoverflow.com/questions/32556295/npm-install-error-the-build-tools-for-v120-platform-toolset-v120-cannot

               https://github.com/nodejs/node-gyp/issues/679

          oh!are you use vs2012?

               so you should run npm install --msvs_version=2012

          just try

          As well instead of each time writing "npm install --msvs_version=2015"

          you can make system variable GYP_MSVS_VERSION = '2015'.

          I've just installed oraclebd on Win'7 x64 with this howto. Thanks a lot @bchr02 for this!

          Before installation VS2015 CE was already installed but without C++ part. So I have got same errors. Then I start VS2015 and choose New project - C++ - Add WindowsSDK 10. After installation has finished and creating GYP_MSVS_VERSION env. variable node-gyp started to compile without errors.

          BTW, it said that Microsoft Visual C++ Build Tools 2015 Technical Preview could be used now instead of installing MS VisualStudio. I didn't try it yet.

          Pollocks01