当前位置: 首页 > 知识库问答 >
问题:

在Windows上为Node.js依赖项运行Python

鲍高扬
2023-03-14
Your environment has been set up for using Node.js 0.8.21 (x64) and NPM

C:\Users\Matt Cashatt>npm install jquery
npm http GET https://registry.npmjs.org/jquery
npm http 304 https://registry.npmjs.org/jquery
npm http GET https://registry.npmjs.org/jsdom
npm http GET https://registry.npmjs.org/xmlhttprequest
npm http GET https://registry.npmjs.org/htmlparser/1.7.6
npm http GET https://registry.npmjs.org/location/0.0.1
npm http GET https://registry.npmjs.org/navigator
npm http GET https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/htmlparser/1.7.6
npm http 304 https://registry.npmjs.org/xmlhttprequest
npm http 304 https://registry.npmjs.org/location/0.0.1
npm http 304 https://registry.npmjs.org/navigator
npm http 304 https://registry.npmjs.org/jsdom
npm http 304 https://registry.npmjs.org/contextify
npm http GET https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/cssom
npm http GET https://registry.npmjs.org/cssstyle
npm http GET https://registry.npmjs.org/request
npm http 304 https://registry.npmjs.org/bindings

> contextify@0.1.4 install C:\Users\Matt Cashatt\node_modules\jquery\node_module
s\contextify
> node-gyp rebuild


C:\Users\Matt Cashatt\node_modules\jquery\node_modules\contextify>node "C:\Progr
am Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\b
in\node-gyp.js" rebuild
npm http 304 https://registry.npmjs.org/cssstyle
npm http 304 https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/request
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variable.
gyp ERR! stack     at failNoPython (C:\Program Files\nodejs\node_modules\npm\nod
e_modules\node-gyp\lib\configure.js:113:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node
-gyp\lib\configure.js:82:11
gyp ERR! stack     at Object.oncomplete (fs.js:297:15)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu
les\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Matt Cashatt\node_modules\jquery\node_modules\contextify
gyp ERR! node -v v0.8.21
gyp ERR! node-gyp -v v0.8.4
gyp ERR! not ok
npm ERR! error rolling back Error: ENOTEMPTY, rmdir 'C:\Users\Matt Cashatt\node_
modules\jquery\node_modules\jsdom\node_modules\request\tests'
npm ERR! error rolling back  jquery@1.8.3 { [Error: ENOTEMPTY, rmdir 'C:\Users\M
att Cashatt\node_modules\jquery\node_modules\jsdom\node_modules\request\tests']
npm ERR! error rolling back   errno: 53,
npm ERR! error rolling back   code: 'ENOTEMPTY',
npm ERR! error rolling back   path: 'C:\\Users\\Matt Cashatt\\node_modules\\jque
ry\\node_modules\\jsdom\\node_modules\\request\\tests' }
npm ERR! contextify@0.1.4 install: `node-gyp rebuild`
npm ERR! `cmd "/c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the contextify@0.1.4 install script.
npm ERR! This is most likely a problem with the contextify 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 contextify
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "jquery"
npm ERR! cwd C:\Users\Matt Cashatt
npm ERR! node -v v0.8.21
npm ERR! npm -v 1.2.11
npm ERR! code ELIFECYCLE
npm ERR! Error: ENOENT, lstat 'C:\Users\Matt Cashatt\node_modules\jquery\node_mo
dules\jsdom\node_modules\request\tests\test-pipes.js'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "jquery"
npm ERR! cwd C:\Users\Matt Cashatt
npm ERR! node -v v0.8.21
npm ERR! npm -v 1.2.11
npm ERR! path C:\Users\Matt Cashatt\node_modules\jquery\node_modules\jsdom\node_
modules\request\tests\test-pipes.js
npm ERR! fstream_path C:\Users\Matt Cashatt\node_modules\jquery\node_modules\jsd
om\node_modules\request\tests\test-pipes.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack C:\Program Files\nodejs\node_modules\npm\node_modules\fst
ream\lib\writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:297:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\Matt Cashatt\npm-debug.log
npm ERR! not ok code 0

C:\Users\Matt Cashatt>

共有1个答案

孙绍辉
2023-03-14

如果您还没有安装python以及所有node-gyp依赖项,只需使用管理员权限打开Powershell或Git Bash并执行:

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

然后安装软件包:

npm install --global node-gyp

一旦安装,您将下载所有的node-gyp依赖项,但仍然需要环境变量。Validate Python确实在正确的文件夹中找到:

C:\Users\ben\.windows-build-tools\python27\python.exe 
setx PYTHON "%USERPROFILE%\.windows-build-tools\python27\python.exe"
 类似资料:
  • 问题内容: 我正在进入Node.js代码库,该代码库要求我通过NPM(即jQuery)下载一些依赖项。 在尝试运行时,我不断出现此错误: 看来失败是由于缺少Python安装造成的。好了,我已经安装了Python,设置了变量,然后重新启动,仍然是错误。 关于我所缺少的任何线索吗? 问题答案: 您的问题是您 没有 设置环境变量。 该错误清楚地表明: 在评论中,您说您这样做: 很好,但是没有设置变量,而

  • 我试图建立一个VC(VS 2008)OCX(32位)项目在Windows 8.1 64位机器。OCX正在构建中,但是在尝试使用regsvr32注册时没有加载。使用依赖沃克检查二进制文件显示MSVCR90。DLL作为缺失的依赖项之一。但是我可以看到这个dll在C:\windows\winSxs区域下的相应文件夹中可用。无法找出WinSxS无法定位DLL的原因。 报告为缺失的其他依赖项包括 API-M

  • 我创建了一个Maven项目(可重用库),该项目有许多依赖项(编译时和运行时),它们也可以过渡地依赖于其他许多依赖项。在maven中,我可以在pom中添加依赖项。xml及其可传递依赖关系将自动处理。所以,我将毫无问题地运行。 现在,我有一个非Maven(基于Ant的)项目,上面创建的库(Maven Lib)将使用它。 在这种情况下,运行时间

  • 当我将此添加到我的项目父pom时: 项目运行失败如下: 当我删除依赖项时,项目将成功运行。 我只是想添加一个Eureka客户端到注册中心,但它不起作用。但是,当我使用Spring初始化器创建一个新项目时,它工作得很好。 每个答案都有帮助。 完整的项目如下:

  • 使用我可以完美地运行 3.5.3(默认,2020年7月9日13:00:10)[GCC 6.3.0 20170516]` 但我不能使用依赖项,例如 第一次尝试执行 没有希望 第二次尝试 得到错误 我遇到一个相似的人问同样的问题,但没有回答 问题: 如何在下安装和运行python依赖项?

  • 问题内容: 提出的每个选项都有一个问题: 我想在普通设备上运行它,所以我希望避免在设备上安装其他操作系统 上个月停止了对JXCore的工作,并且(可能是结果)我无法对其进行编译 自2014年以来就没有开发过NodeJs Anode的Android Port,而且当时并没有真正维护它 我链接到的第二个线程中的第二个答案现在提到了Android的官方节点发行版,但是除了指向最新dist的Browse-