【问题标题】:npm install failed with node-sass and node-gypnpm install 使用 node-sass 和 node-gyp 失败
【发布时间】:2020-09-11 18:11:03
【问题描述】:

当我使用 Angular 在我的 ionic 项目上安装 npm 时。 node-sass/node-gyp 安装失败 错误显示如下:

$ npm 安装

node-sass@4.10.0 安装 C:\Users\d\Documents\project\app\node_modules\node-sass 节点脚本/install.js

从以下位置下载二进制文件 https://github.com/sass/node-sass/releases/download/v4.10.0/win32-x64-72_binding.node 无法下载 "https://github.com/sass/node-sass/releases/download/v4.10.0/win32-x64-72_binding.node":

找不到 HTTP 错误 404

提示:如果您所在位置无法访问 github.com 尝试通过 HTTP_PROXY 设置代理,例如

  export HTTP_PROXY=http://example.com:1234

或通过配置 npm 代理

  npm config set proxy http://example.com:8080

node-sass@4.10.0 安装后 C:\Users\d\Documents\project\app\node_modules\node-sass 节点脚本/build.js

构建:C:\Program Files\nodejs\node.exe C:\Users\d\Documents\project\app\node_modules\node-gyp\bin\node-gyp.js 重建 --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= gyp info 如果它以 ok gyp verb cli [ gyp verb cli 'C:\Program Files\nodejs\node.exe', gyp verb cli
结尾则有效 'C:\Users\d\Documents\project\app\node_modules\node-gyp\bin\node-gyp.js', gyp 动词 cli 'rebuild', gyp 动词 cli '--verbose', gyp 动词 cli
'--libsass_ext=', gyp 动词 cli '--libsass_cflags=', gyp 动词 cli
'--libsass_ldflags=', gyp 动词 cli '--libsass_library=' gyp 动词 cli ] 使用 node-gyp@3.8.0 的 gyp 信息 使用 node@12.13.1 的 gyp 信息 | win32 | x64 gyp 动词命令重建 [] gyp 动词命令 clean [] gyp 动词 清除“构建”目录 gyp 动词命令 configure [] gyp 动词检查 python 检查 Python 可执行文件 PATH gyp 中的“C:\Users\d.windows-build-tools\python27\python.exe” 动词which 失败错误:未找到: C:\Users\d.windows-build-tools\python27\python.exe gyp动词which 在 getNotFoundError 失败 (C:\Users\d\Documents\project\app\node_modules\which\which.js:13:12) gyp动词which在F失败 (C:\Users\d\Documents\project\app\node_modules\which\which.js:68:19) gyp动词which在E失败 (C:\Users\d\Documents\project\app\node_modules\which\which.js:80:29) gyp 动词 which 失败于 C:\Users\d\Documents\project\app\node_modules\which\which.js:89:16 gyp 动词which 失败于 C:\Users\d\Documents\project\app\node_modules\isexe\index.js:42:5 gyp 动词which 失败于 C:\Users\d\Documents\project\app\node_modules\isexe\windows.js:36:5 gyp 动词 which 在 FSReqCallback.oncomplete (fs.js:158:21) 失败 gyp动词which失败 C:\Users\d.windows-build-tools\python27\python.exe 错误:未找到: C:\Users\d.windows-build-tools\python27\python.exe gyp动词which 在 getNotFoundError 失败 (C:\Users\d\Documents\project\app\node_modules\which\which.js:13:12) gyp动词which在F失败 (C:\Users\d\Documents\project\app\node_modules\which\which.js:68:19) gyp动词which在E失败 (C:\Users\d\Documents\project\app\node_modules\which\which.js:80:29) gyp 动词 which 失败于 C:\Users\d\Documents\project\app\node_modules\which\which.js:89:16 gyp 动词which 失败于 C:\Users\d\Documents\project\app\node_modules\isexe\index.js:42:5 gyp 动词which 失败于 C:\Users\d\Documents\project\app\node_modules\isexe\windows.js:36:5 gyp 动词 which 在 FSReqCallback.oncomplete (fs.js:158:21) 失败 { gyp 动词 which 堆栈失败:'错误:未找到: C:\Users\d\.windows-build-tools\python27\python.exe\n' + gyp 动词 which 失败 ' 在 getNotFoundError (C:\Users\d\Documents\project\app\node_modules\which\which.js:13:12)\n' + gyp 动词 which 失败 ' 在 F (C:\Users\d\Documents\project\app\node_modules\which\which.js:68:19)\n' + gyp 动词 which 失败 ' 在 E (C:\Users\d\Documents\project\app\node_modules\which\which.js:80:29)\n' + gyp 动词 which 失败 ' 在 C:\Users\d\Documents\project\app\node_modules\which\which.js:89:16\n' + gyp 动词 which 失败 ' 在 C:\Users\d\Documents\project\app\node_modules\isexe\index.js:42:5\n' + gyp 动词 which 失败 ' 在 C:\Users\d\Documents\project\app\node_modules\isexe\windows.js:36:5\n' + gyp 动词 which 失败 ' 在 FSReqCallback.oncomplete (fs.js:158:21)',gyp 动词 which 失败代码:'ENOENT' gyp 动词 which failed } gyp 动词找不到 “C:\Users\d.windows-build-tools\python27\python.exe”。检查蟒蛇 启动器 gyp 动词找不到 “C:\Users\d.windows-build-tools\python27\python.exe”。猜测 位置 gyp 动词确保文件存在:C:\Python27\python.exe gyp 动词检查 python 版本C:\Python27\python.exe -c "import sys; print "2.7.16 gyp verb check python version .%s.%s" % sys.version_info[:3];" 返回:%j gyp verb get node dir no --target 指定版本,回退到主机节点版本:12.13.1 gyp 动词 command install [ '12.13.1' ] gyp verb install 输入版本字符串 “12.13.1” gyp verb install 安装版本:12.13.1 gyp verb install --ensure 已通过,如果已安装则不会重新安装 gyp动词安装版本已经安装,需要检查 “installVersion” gyp 动词得到“installVersion” 9 gyp 动词需要 "installVersion" 9 gyp 动词安装版本好 gyp 动词 get 节点 安装的 dir 目标节点版本:12.13.1 gyp verb build dir 试图创建“构建”目录: C:\Users\d\Documents\project\app\node_modules\node-sass\build gyp 动词 需要创建构建目录“构建”目录? C:\Users\d\Documents\project\app\node_modules\node-sass\build gyp 动词 find vs2017 找到安装在:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise gyp 动词 find vs2017 - 找到 Microsoft.VisualStudio.Component.Windows10SDK.18362 gyp 动词查找 vs2017 - 找到 Microsoft.VisualStudio.Component.VC.Tools.x86.x64 gyp 动词 find vs2017 - 找到 Microsoft.VisualStudio.VC.MSBuild.Base gyp 动词 find vs2017 - 将此安装与 Windows 10 SDK gyp 一起使用 动词使用安装找到 vs2017:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise gyp 动词 build/config.gypi 创建 配置文件 gyp 动词 build/config.gypi 写出配置文件: C:\Users\d\Documents\project\app\node_modules\node-sass\build\config.gypi gyp 动词 config.gypi 检查 gypi 文件: C:\Users\d\Documents\project\app\node_modules\node-sass\config.gypi gyp 动词 common.gypi 检查 gypi 文件: C:\Users\d\Documents\project\app\node_modules\node-sass\common.gypi 未指定 gyp 动词 gyp gyp 格式;强制“msvs”gyp信息 spawn C:\Python27\python.exe gyp info spawn args [ gyp info spawn args 'C:\Users\d\Documents\project\app\node_modules\node-gyp\gyp\gyp_main.py', gyp 信息产生 args 'binding.gyp',gyp 信息产生 args '-f',gyp 信息生成 args 'msvs',gyp 信息生成 args '-G',gyp 信息生成 args 'msvs_version=2015', gyp info spawn args '-I', gyp info spawn 参数
'C:\Users\d\Documents\project\app\node_modules\node-sass\build\config.gypi', gyp info spawn args '-I', gyp info spawn args
'C:\Users\d\Documents\project\app\node_modules\node-gyp\addon.gypi', gyp info spawn args '-I', gyp info spawn args
'C:\Users\d\.node-gyp\12.13.1\include\node\common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args
'-Dvisibility=default', gyp info spawn args
'-Dnode_root_dir=C:\Users\d\.node-gyp\12.13.1', gyp info spawn 参数
'-Dnode_gyp_dir=C:\Users\d\Documents\project\app\node_modules\node-gyp', gyp info spawn args
'-Dnode_lib_file=C:\Users\d\.node-gyp\12.13.1\ '-Dmodule_root_dir=C:\Users\d\Documents\project\app\node_modules\node-sass', gyp info spawn args '-Dnode_engine=v8', gyp info spawn args
'--depth=.', gyp info spawn args '--no-parallel', gyp info spawn args '--generator-output', gyp info spawn args
'C:\Users\d\Documents\project\app\node_modules\node-sass\build', gyp info spawn args '-Goutput_dir=.' gyp info spawn args ] gyp动词 command build [] gyp verb build type 发布 gyp verb architecture x64 gyp verb node dev dir C:\Users\d.node-gyp\12.13.1 gyp verb found 使用 MSBuild 的第一个解决方案文件 build/binding.sln gyp 动词: C:\Program 文件 (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\15.0\Bin\MSBuild.exe gyp info spawn C:\Program 文件 (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\15.0\Bin\MSBuild.exe gyp info spawn args [ gyp info spawn args 'build/binding.sln', gyp info spawn args '/nologo', gyp info spawn args
'/p:Configuration=Release;Platform=x64' gyp info spawn args ] gyp ERR! 未捕获的异常 gyp 错误!堆栈错误:产生 C:\Program Files (x86)\微软视觉 Studio\2019\Enterprise\MSBuild\15.0\Bin\MSBuild.exe ENOENT gyp 错误! Process.ChildProcess._handle.onexit 处的堆栈 (内部/child_process.js:264:19)gyp 错误!堆栈在 onErrorNT (内部/child_process.js:456:16)gyp 错误!堆栈在 processTicksAndRejections (internal/process/task_queues.js:80:21) gyp 呃!系统 Windows_NT 10.0.18362 gyp 错误!命令“C:\程序 文件\nodejs\node.exe" “C:\Users\d\Documents\project\app\node_modules\node-gyp\bin\node-gyp.js” "重建" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=""--libsass_library="gyp 错误! cwd C:\Users\d\Documents\project\app\node_modules\node-sass gyp 错误!节点 -v v12.13.1 gyp 错误!节点-gyp -v v3.8.0 gyp 错误!这是node-gyp 中的一个错误。吉普错误!尝试更新 node-gyp 并提交问题,如果它 没有帮助:gyp ERR!
https://github.com/nodejs/node-gyp/issues 构建失败并出现错误 代码:7 npm WARN angular-ng-autocomplete@1.1.12 需要对等 @angular/common@^6.0.0-rc.0 || ^6.0.0 但没有安装。你必须 自己安装对等依赖项。 npm 警告 angular-ng-autocomplete@1.1.12 需要一个同行 @angular/core@^6.0.0-rc.0 || ^6.0.0 但没有安装。你必须 自己安装对等依赖项。 npm 警告 angular-resize-event@1.2.1 需要 @angular/core@^8.2.14 的同级 但没有安装。您必须自己安装对等依赖项。 npm WARN angular-resize-event@1.2.1 需要一个 rxjs@~6.5.4 但是 没有安装。您必须自己安装对等依赖项。
npm WARN angular-resize-event@1.2.1 需要 core-js@^3.6.1 的同级 但没有安装。您必须自己安装对等依赖项。
npm WARN 可选跳过可选依赖:fsevents@1.2.4 (node_modules\fsevents): npm WARN notsup 跳过可选依赖: fsevents@1.2.4 不受支持的平台:需要 {"os":"darwin","arch":"any"}(当前: {"os":"win32","arch":"x64"})win32","arch":"x64"}) npm WARN 可选 跳过可选依赖:node-sass@4.10.0 (node_modules\node-sass): npm WARN 可选 SKIPPING OPTIONAL 依赖:node-sass@4.10.0 安装后:node scripts/build.js npm WARN optional SKIPPING OPTIONAL DEPENDENCY:退出状态 1

添加了来自 166 个贡献者的 83 个包,删除了 618 个包,更新了 在 52.38 秒内发现 191 个包和审计 1597 个包 2966 个 漏洞(2197 个低、11 个中等、756 个高、2 个严重)运行 npm audit fix 修复它们,或npm audit 了解详情

package.json

{
  "name": "project",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "7.1.4",
    "@angular/cdk": "7.1.0",
    "@angular/common": "7.1.4",
    "@angular/core": "7.1.4",
    "@angular/forms": "7.1.4",
    "@angular/http": "7.1.4",
    "@angular/platform-browser": "7.1.4",
    "@angular/platform-browser-dynamic": "7.1.4",
    "@angular/router": "7.1.4",
    "@fortawesome/fontawesome-free": "5.12.0",
    "@ionic-native/core": "5.1.0",
    "@ionic-native/file": "5.1.0",
    "@ionic-native/file-path": "5.1.0",
    "@ionic-native/file-transfer": "5.1.0",
    "@ionic-native/in-app-browser": "5.5.1",
    "@ionic-native/native-page-transitions": "5.5.1",
    "@ionic-native/splash-screen": "5.1.0",
    "@ionic-native/status-bar": "5.1.0",
    "@ionic/angular": "4.0.0-beta.15",
    "@kolkov/angular-editor": "^0.15.1",
    "@progress/kendo-angular-buttons": "^4.0.0",
    "@progress/kendo-angular-charts": "3.9.0",
    "@progress/kendo-angular-dateinputs": "2 - 3",
    "@progress/kendo-angular-dropdowns": "2 - 3",
    "@progress/kendo-angular-excel-export": "1 - 2",
    "@progress/kendo-angular-grid": "^3.14.4",
    "@progress/kendo-angular-inputs": "2 - 5",
    "@progress/kendo-angular-intl": "^1.0.0",
    "@progress/kendo-angular-l10n": "^1.1.0",
    "@progress/kendo-angular-popup": "^2.0.0",
    "@progress/kendo-data-query": "^1.0.0",
    "@progress/kendo-drawing": "^1.0.0",
    "@progress/kendo-theme-default": "latest",
    "angular-gridster2": "^7.2.0",
    "angular-ng-autocomplete": "1.1.12",
    "angular-resize-event": "1.2.1",
    "cordova-android": "8.0.0",
    "cordova-ios": "5.0.1",
    "cordova-plugin-device": "2.0.2",
    "cordova-plugin-ionic-webview": "2.3.1",
    "cordova-plugin-splashscreen": "5.0.2",
    "cordova-plugin-statusbar": "2.4.2",
    "cordova-plugin-whitelist": "1.3.3",
    "core-js": "^2.4.1",
    "file-saver": "^2.0.2",
    "hammerjs": "2.0.0",
    "ionic": "4.6.0",
    "jspdf": "^1.5.3",
    "jszip": "^3.2.2",
    "lodash": "4.17.15",
    "moment": "2.24.0",
    "mydatepicker": "2.6.6",
    "ng-select": "1.0.2",
    "ng2-ace-editor": "0.3.9",
    "ngx-bootstrap": "5.3.2",
    "ngx-color-picker": "^5.3.8",
    "ngx-dropzone": "1.2.0",
    "ngx-perfect-scrollbar": "7.2.1",
    "release": "6.0.1",
    "rxjs": "6.3.3",
    "rxjs-compat": "^6.0.0",
    "stream": "0.0.2",
    "tslib": "1.9.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/architect": "0.11.4",
    "@angular-devkit/build-angular": "0.11.4",
    "@angular-devkit/core": "7.1.4",
    "@angular-devkit/schematics": "7.1.4",
    "@angular/cli": "7.1.4",
    "@angular/compiler": "7.1.4",
    "@angular/compiler-cli": "7.1.4",
    "@angular/language-service": "7.1.4",
    "@ionic/angular-toolkit": "1.2.0",
    "@types/node": "10.12.0",
    "@types/jasmine": "2.8.8",
    "@types/jasminewd2": "2.0.3",
    "codelyzer": "4.5.0",
    "jasmine-core": "2.99.1",
    "jasmine-spec-reporter": "4.2.1",
    "karma": "3.1.4",
    "karma-chrome-launcher": "2.2.0",
    "karma-coverage-istanbul-reporter": "2.0.1",
    "karma-jasmine": "1.1.2",
    "karma-jasmine-html-reporter": "0.2.2",
    "protractor": "5.4.0",
    "ts-node": "7.0.0",
    "tslint": "5.12.0",
    "typescript": "3.1.6",
    "@svgdotjs/svg.js": "3.0.16"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "cordova-plugin-ionic-keyboard": {},
      "com.telerik.plugins.nativepagetransitions": {},
      "cordova-plugin-inappbrowser": {}
    },
    "platforms": [
      "android",
      "ios"
    ]
  }
}

npm 版本:6.14.4

【问题讨论】:

    标签: angular ionic-framework node-gyp node-sass


    【解决方案1】:

    重新安装Node Js,在其中一个页面安装时,会有一个复选框来安装额外的工具,只需选中它,然后单击下一步。安装 Node js 后,它会打开一个额外的窗口,要求您按键,继续操作。完成安装后,执行您在上述情况下所做的操作。那么它应该可以工作了。

    【讨论】:

      【解决方案2】:

      我有同样的问题,但花了几个小时后,我使用了 Visual Studio 代码扩展名 Live Sass-compiler 它解决了我的问题,它将 .scss 代码编译为 .css 文件目录只是在组件中导入.css文件。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-08-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-11-01
        • 2015-03-28
        • 2022-01-15
        相关资源
        最近更新 更多