npm install java:错误 MSB4019:找不到导入的项目"D:Microsoft.Cpp.Default.props"



我们尝试使用节点java桥来运行Java应用程序。

如要求中所述,我们必须在节点项目中安装 java。

所以我正在运行

npm install java

我已经运行了许多论坛中建议的以下命令,例如

npm install --global windows-build-tools
npm install -g nw-gyp

低于异常。

PS D> npm install java

java@0.10.0 install D:odebrigdeode_modules\java 节点-gyp 重建

D:\nodebrigdenode_modulesjava>if not defined npm_config_node_gyp (node "C:Program Filesnodejsnode_modulesnpmnode_modulesnpm-lifecyclenode-gyp-bin\....no
de_modulesnode-gypbinnode-gyp.js" rebuild )  else (node "C:Program Filesnodejsnode_modulesnpmnode_modulesnode-gypbinnode-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
D:nodebrigdenode_modulesjavabuildnodejavabridge_bindings.vcxproj(20,3): error MSB4019: The imported project "D:Microsoft.Cpp.Default.props" was not found. Co
nfirm that the path in the <Import> declaration is correct, and that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error: `C:WindowsMicrosoft.NETFrameworkv4.0.30319msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:Program Filesnodejsnode_modulesnpmnode_modulesnode-gyplibbuild.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.15063
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"
gyp ERR! cwd D:nodebrigdenode_modulesjava
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modulesfsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! java@0.10.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the java@0.10.0 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:UsersAppDataRoamingnpm-cache_logs2018-06-25T10_03_58_299Z-debug.log

如果可能,请详细建议,因为我是角度/节点的新手

最初于 2020 年 3 月为 Windows 编写。

  1. 跑:

    npm install --global --production windows-build-tools@4.0.0

  2. 添加名为"VCTargetsPath"的环境变量 具有 Microsoft.Cpp.Default.props 文件夹路径的值。在我的计算机上,它是"C:\Program Files (x86(\MSBuild\Microsoft.Cpp\v4.0\v140"。

  3. 尝试再次下载软件包

===

编辑:

我已经知道这可以通过给节点提供 python 的路径来解决。(我认为版本不重要?尝试跑步:

npm config set python pathtofilepython.exe

相关内容

最新更新