程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

NPM installation Python env

編輯:Python

How many recently GitHub Project , Many installation dependencies report errors , One of them node-sass I really didn't expect .

Let's talk about it first. npm、cnpm、yarn install When , The same project will have different results , Under the same project :npm:

npm ERR! Found: [email protected]
npm ERR! node_modules/swiper
npm ERR! [email protected]"^6.3.5" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer [email protected]"^5.2.0" from [email protected]
npm ERR! node_modules/vue-awesome-swiper
npm ERR! [email protected]"^4.1.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\dell\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dell\AppData\Local\npm-cache_logs\2022-05-11T01_47_03_130Z-debug.log

The version of the wrong package will be reported directly , It is estimated that yarn and cnpm There will also be errors , But I don't know why I reported this wrong .

cnpm、yarn:

 ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Users\dell\Desktop\my\lowcode\quark-h5-master\[email protected]@node-gyp\lib\configure.js:484:19)
gyp ERR! stack at PythonFinder.<anonymous> (C:\Users\dell\Desktop\my\lowcode\quark-h5-master\[email protected]@node-gyp\lib\configure.js:509:16)
gyp ERR! stack at callback (C:\Users\dell\Desktop\my\lowcode\quark-h5-master\[email protected]@graceful-fs\polyfills.js:306:20)
gyp ERR! stack at FSReqCallback.oncomplete (node:fs:198:21)
gyp ERR! System Windows_NT 10.0.22000
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\dell\Desktop\my\lowcode\quark-h5-master\node_modules\[email protected]@node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\dell\Desktop\my\lowcode\quark-h5-master\[email protected]@node-sass
gyp ERR! node -v v16.13.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

Maybe for older projects node-sass, So you need to install Python, This question was shared before node-sass Relevant also mentioned , I just didn't meet you at that time , I didn't elaborate . It's a little magical , Yes npm、cnpm, Not deleted node_modules, It was a success , However, the startup error is reported, and some dependent packages cannot be found .

The above is not the point , The point is how to solve : Error: Can't find Python executable "python", you can set the PYTHON env variable.

There are many online methods , Whether you can do it or not, you have to try it yourself , Let me talk about my solution : perform npm install --global --production windows-build-tools, Then it gets stuck , It can be terminated directly . After termination, there will be a path :

C Disk open this path :

double-click python-2.7.15.amd64.msi, Select remove first :

And then double-click python-2.7.15.amd64.msi, All the way default next until finish.

If you install the dependency successfully, you won't report an error .

Now the new bag should not be used node-sass 了 , But I don't know if other packages also have dependencies Python Of , Still have to solve .


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved