问题
I have a simple node.js server and some app running on it, that should connect to Oracle database. For that reason I decided to use node-oracledb
driver, but I'm having some problems with installation. I followed instructions on Oracle webpage and those on github, but I still get an error below.
My environment configuration:
- Windows 8.1 Pro 64 bit
- node.js v6.4.0
- npm v3.10.3
- MS Visual Studio 2013 Community edition
- Python v2.7.12
- Oracle Instant Client (basic + SDK) v12.1.0.2.0
Node, Python and Oracle Instant Client folders are included in PATH variable. OCI_LIB_DIR and OCI_INC_DIR are also set according to github instructions.
Here's the problem: when I execute command npm install oracledb -g
, the following error occurs:
> oracledb@1.11.0 install C:\Users\pr\AppData\Roaming\npm\node_modules\ora
cledb
> node-gyp rebuild
C:\Users\pr\AppData\Roaming\npm\node_modules\oracledb>if not defined npm_c
onfig_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\
\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
C:\Users\pr\AppData\Roaming\npm\node_modules\oracledb\build\oracledb.vcxp
roj(20,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props"
was not found. Confirm that the path in the <Import> declaration is correct, a
nd that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\
npm\node_modules\node-gyp\lib\build.js:276:23)
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_proces
s.js:204:12)
gyp ERR! System Windows_NT 6.3.9600
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\pr\AppData\Roaming\npm\node_modules\oracledb
gyp ERR! node -v v6.4.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "oracledb" "-g"
npm ERR! node v6.4.0
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! oracledb@1.11.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the oracledb@1.11.0 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, 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 information on how to open an issue for this project with:
npm ERR! npm bugs oracledb
npm ERR! Or if that isn't available, 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\pr\Development\Visual Studio 2013\npm-debug.log
I don't really know where to look at for a solution. What could cause that error? Are there any known incompatibilities between node/oracle client/python?
One more thing: github instructions say:
Make sure the Microsoft Visual Studio environment variables are set appropriately. Use set PATH and verify it contains your Visual Studio paths. If they are not set, use vcvars64.bat (or vcvars.bat if you building with 32-bit binaries) to set the environment.
Which VS environment variables should be set and which VS paths should be contained in PATH exactly?
回答1:
Modules like oracledb or node-oracledb needs compilations. Compilation requires software like C compiler, Python etc.
I was facing the same issue with oracldb module. follow below instructions and it works like charm.
https://community.oracle.com/docs/DOC-931127
回答2:
try updating npm to the latest version:
npm install -g npm
if it still doesn't work, try including your VS version like so:
npm install oracledb --msvs_version=2013
来源:https://stackoverflow.com/questions/39037671/error-while-installing-node-oracledb