首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >node- PYTHONPATH问题

node- PYTHONPATH问题
EN

Stack Overflow用户
提问于 2018-12-22 03:51:27
回答 1查看 1.4K关注 0票数 1

我在我的项目中运行节点8.11.3的MAC上,得到以下错误:

代码语言:javascript
运行
复制
$ npm install

> chacha-native@2.0.2 install /Users/MYUSERNAME/boatnet/observer/obs-web/node_modules/chacha-native
> node-gyp rebuild

Your PYTHONPATH points to a site-packages dir for Python 3.x but you are running Python 2.x!
     PYTHONPATH is currently: "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib:/usr/local/lib/python2.7/site-packages"
     You should `unset PYTHONPATH` to fix this.
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
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 Darwin 16.7.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/MYUSERNAME/boatnet/observer/obs-web/node_modules/chacha-native
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

package.json如下:

代码语言:javascript
运行
复制
{
  "name": "obs-web",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "build-webapp": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "postinstall": "node build/patch/patch-electron-fs.js"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^7.1.4",
    "@angular/cdk": "^6.4.7",
    "@angular/common": "^7.1.4",
    "@angular/compiler": "^7.1.4",
    "@angular/core": "^7.1.4",
    "@angular/forms": "^7.1.4",
    "@angular/http": "^7.1.4",
    "@angular/material": "^6.4.7",
    "@angular/platform-browser": "^7.1.4",
    "@angular/platform-browser-dynamic": "^7.1.4",
    "@angular/router": "^7.1.4",
    "chacha": "^2.1.0",
    "core-js": "^2.5.4",
    "crypto-pouch": "^3.1.3",
    "hammerjs": "^2.0.8",
    "moment": "^2.22.2",
    "node-gyp": "^3.8.0",
    "npm": "^6.4.1",
    "pouchdb": "^7.0.0",
    "pouchdb-find": "^7.0.0",
    "primeicons": "^1.0.0",
    "primeng": "^6.1.6",
    "rxjs": "^6.3.3",
    "stream": "0.0.2",
    "tslib": "^1.9.0",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.11.0",
    "@angular/cli": "~7.1.4",
    "@angular/compiler-cli": "^7.1.4",
    "@angular/language-service": "^7.1.4",
    "@types/jasmine": "^2.8.11",
    "@types/jasminewd2": "^2.0.6",
    "@types/node": "^8.10.38",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^3.1.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^2.0.4",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "^5.4.1",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "~3.1.6"
  }
}

我试图创建一个虚拟环境,但仍然有问题。我必须使用管理员帐户来安装node-gyp,不确定这是否是问题所在。

python -V返回“Python2.7.14”我甚至尝试取消设置PYTHONPATH,但我得到了相同的错误。

EN

Stack Overflow用户

发布于 2019-01-18 00:29:37

你已经解决这个问题了吗?

我有同样的问题已经有一个星期了。这个问题是在我安装了一些hackrf包(使用python3.x)之后出现的。

正因为如此,我更需要NodeJS,而不是那些python3包,我只是卸载了python3,删除了/usr/local/lib/python3.6//usr/local/lib/python3.7/,或者您拥有的任何python3版本。

是的,我知道这不是最好的解决方案,但至少比你根本不能工作要好,我猜(这就是我的想法)

ps。也许有人根据我解决这个问题的方式对这个问题有一个很好的解释。

编辑:请注意,pip本身不应被删除

票数 1
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53890115

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档