Неудачное npm обновление и npm установка - PullRequest
0 голосов
/ 23 марта 2020

Мне кажется, что я попробовал почти все, чтобы разобраться с проектами, использующими npm, но безуспешно.

При запуске как npm install, так и npm update я получаю следующая ошибка.

> grpc@1.20.0 install /Users/bennetthuffman/code/tedapp/node_modules/@firebase/firestore/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp WARN Tried to download(404): https://node-precompiled-binaries.grpc.io/grpc/v1.20.0/node-v72-darwin-x64-unknown.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for grpc@1.20.0 and node@12.16.1 (node-v72 ABI, unknown) (falling back to source compile with node-gyp) 
Traceback (most recent call last):
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 50, in <module>
    sys.exit(gyp.script_main())
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 554, in script_main
    return main(sys.argv[1:])
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 547, in main
    return gyp_main(args)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 532, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 2215, in GenerateOutput
    part_of_all=qualified_target in needed_targets)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 802, in Write
    self.WriteCopies(spec['copies'], extra_outputs, part_of_all)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1145, in WriteCopies
    env = self.GetSortedXcodeEnv()
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1885, in GetSortedXcodeEnv
    additional_settings)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1616, in GetSortedXcodeEnv
    additional_settings)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1527, in _GetXcodeEnv
    if XcodeVersion() >= '0500' and not env.get('SDKROOT'):
TypeError: '>=' not supported between instances of 'tuple' and 'str'
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:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=/Users/bennetthuffman/code/tedapp/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/Users/bennetthuffman/code/tedapp/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /Users/bennetthuffman/code/tedapp/node_modules/@firebase/firestore/node_modules/grpc
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/Users/bennetthuffman/code/tedapp/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/bennetthuffman/code/tedapp/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/bennetthuffman/code/tedapp/node_modules/@firebase/firestore/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
node-pre-gyp ERR! System Darwin 19.3.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/bennetthuffman/code/tedapp/node_modules/@firebase/firestore/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /Users/bennetthuffman/code/tedapp/node_modules/@firebase/firestore/node_modules/grpc
node-pre-gyp ERR! node -v v12.16.1
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/Users/bennetthuffman/code/tedapp/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/bennetthuffman/code/tedapp/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm WARN ajv-keywords@3.4.0 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN react-dom@16.6.3 requires a peer of react@^16.6.3 but none is installed. You must install peer dependencies yourself.
npm WARN react-edit-inline@1.0.8 requires a peer of react@^0.14.6 || 15.x.x but none is installed. You must install peer dependencies yourself.
npm WARN react-spring@8.0.7 requires a peer of react@>= 16.8.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-spring@8.0.7 requires a peer of react-dom@>= 16.8.0 but none is installed. You must install peer dependencies yourself.
npm WARN ts-pnp@1.0.0 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
npm WARN The package react-social-icons is included as both a dev and production dependency.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.20.0 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the grpc@1.20.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!     /Users/bennetthuffman/.npm/_logs/2020-03-22T20_05_03_916Z-debug.log
(base) Bennetts-MBP-2:tedapp bennetthuffman$ :project bennetthuffman$ npm install

> sharp@0.22.1 install /Users/bennetthuffman/code/covidsite/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Using cached /Users/bennetthuffman/.npm/_libvips/libvips-8.7.4-darwin-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=13.7.0 runtime=node arch=x64 libc= platform=darwin)
  TOUCH Release/obj.target/libvips-cpp.stamp
  CXX(target) Release/obj.target/sharp/src/common.o
  CXX(target) Release/obj.target/sharp/src/metadata.o
  CXX(target) Release/obj.target/sharp/src/stats.o
../src/stats.cc:130:19: error: no matching member function for call to 'Set'
        channels->Set(i, channelStat);
        ~~~~~~~~~~^~~
/Users/bennetthuffman/Library/Caches/node-gyp/13.7.0/include/node/v8.h:3547:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/bennetthuffman/Library/Caches/node-gyp/13.7.0/include/node/v8.h:3550:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
1 error generated.
make: *** [Release/obj.target/sharp/src/stats.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:321:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.3.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/bennetthuffman/code/covidsite/node_modules/sharp
gyp ERR! node -v v13.7.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
npm WARN stylelint-webpack-plugin@0.10.5 requires a peer of stylelint@^8.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.22.1 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sharp@0.22.1 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!     /Users/bennetthuffman/.npm/_logs/2020-03-22T19_43_25_294Z-debug.log

Другие вещи, которые я пробовал со смешанными результатами:

  1. Переустановка узла, npm и node-sass
  2. Попытка установить (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy) безуспешно.
  3. Удалено $HOME/.node-gyp и $HOME/.npmrc и перезагрузка компьютера
  4. Не удается запустить npm uninstall node-gyp

Я проследил за этими темами, чтобы попытаться заставить его работать: - https://github.com/nodejs/node-gyp/issues/809

Пожалуйста, дайте мне знать, если есть что-нибудь еще, что я могу предоставить, который поможет. На самом деле я даже подумал о том, чтобы попытаться восстановить заводские настройки, поскольку мне нужно использовать npm для различных проектов и я больше не могу использовать свой компьютер!

Для контекста у меня возникли эти проблемы при обновлении до MacOS Catalina в начале января.

Спасибо !!


РЕДАКТИРОВАТЬ Я пытался работать с двумя проектами, одним старым и одним новым. Это мой пакет. json файл для первого проекта.

{
  "name": "project",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "chartist": "^0.11.0",
    "classnames": "^2.2.6",
    "email-validator": "^2.0.4",
    "emotion": "^10.0.9",
    "fingerprintjs2": "^1.8.6",
    "firebase": "^5.5.4",
    "firebase-admin": "^6.0.0",
    "google-map-react": "^1.1.2",
    "html-react-parser": "^0.6.1",
    "immutable": "^4.0.0-rc.12",
    "moment": "^2.22.2",
    "node-sass": "^4.13.0",
    "rc-time-picker": "^3.4.0",
    "react": "^16.5.2",
    "react-burger-menu": "^2.5.4",
    "react-color": "^2.17.3",
    "react-device-detect": "^1.6.1",
    "react-dom": "^16.6.3",
    "react-edit-inline": "^1.0.8",
    "react-ga": "^2.5.7",
    "react-google-autocomplete": "^1.0.18",
    "react-motion": "^0.5.2",
    "react-popup": "^0.10.0",
    "react-pose": "^4.0.7",
    "react-router-dom": "^4.3.1",
    "react-scripts": "^2.1.5",
    "react-simple-maps": "^0.12.1",
    "react-social-icons": "^4.1.0",
    "react-spinners": "^0.5.1",
    "react-spring": "^8.0.7",
    "reactjs-popup": "^1.3.2",
    "reactstrap": "^7.1.0",
    "styled-components": "^4.1.3",
    "sw-precache": "^5.2.1",
    "sw-precache-webpack-plugin": "^0.11.5"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build && sw-precache --config=sw-precache-config.js",
    "test": "react-scripts test",
    "predeploy": "npm run build",
    "eject": "react-scripts eject",
    "heroku-postbuild": "npm run build"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "engines": {
    "node": "12.13.1",
    "npm": "6.12.1"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ],
  "devDependencies": {
    "babel-plugin-transform-remove-console": "^6.9.4",
    "react-social-icons": "^4.1.0"
  },
  "description": "Our description is here",
  "main": "service-worker.js",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/username/project.git"
  },
  "author": "name",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/username/project/issues"
  },
  "homepage": "https://github.com/username/project#readme"
}

Другой - просто базовый шаблон c stati c веб-сайта (http://staticsiteboilerplate.com/) где я смог заставить npm update и npm install работать, но узел sass не компилируется (я просто вижу html элементов).

{
  "name": "static-site-boilerplate",
  "description": "A modern boilerplate for static website development",
  "version": "1.1.0",
  "homepage": "https://website.org",
  "author": {
    "name": "Bennett Huffman",
    "url": "https://bennetthuffman.com"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/ericalli/static-site-boilerplate.git"
  },
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/ericalli/static-site-boilerplate/issues"
  },
  "keywords": [
    "html5",
    "css3",
    "es6",
    "frontend",
    "sass",
    "less",
    "static",
    "boilerplate",
    "webpack"
  ],
  "scripts": {
    "start": "cross-env NODE_ENV=development webpack-dev-server --config ./config/webpack.config.js",
    "start:dist": "cross-env NODE_ENV=production webpack-dev-server --config ./config/webpack.config.js && http-server ./dist -o",
    "setup": "node ./config/site.setup.js",
    "postinstall": "node ./config/site.setup.js",
    "lint:js": "./node_modules/.bin/eslint \"src/**/*.js\"",
    "lint:styles": "stylelint \"src/**/*.scss\"",
    "build:dist": "cross-env NODE_ENV=production webpack --config ./config/webpack.config.js",
    "deploy": "node ./config/site.deploy.js"
  },
  "devDependencies": {
    "@babel/cli": "^7.8.4",
    "@babel/core": "^7.9.0",
    "@babel/preset-env": "^7.9.0",
    "autoprefixer": "^9.7.4",
    "babel-loader": "^8.1.0",
    "clean-webpack-plugin": "^3.0.0",
    "cross-env": "^5.2.1",
    "css-loader": "^3.4.2",
    "cssnano": "^4.1.10",
    "eslint": "^6.8.0",
    "eslint-config-airbnb-base": "^14.1.0",
    "eslint-loader": "^2.2.1",
    "eslint-plugin-import": "^2.20.1",
    "file-loader": "^4.3.0",
    "glob": "^7.1.6",
    "html-loader": "^0.5.5",
    "html-webpack-plugin": "^4.0.0-beta.14",
    "http-server": "^0.12.1",
    "image-webpack-loader": "^5.1.0",
    "less": "^3.11.1",
    "less-loader": "^5.0.0",
    "mini-css-extract-plugin": "^0.8.2",
    "node-sass": "^4.13.1",
    "optimize-css-assets-webpack-plugin": "^5.0.3",
    "postcss-loader": "^3.0.0",
    "postcss-sass": "^0.4.2",
    "robotstxt-webpack-plugin": "^6.0.0",
    "sass-loader": "^7.3.1",
    "sitemap-webpack-plugin": "^0.6.0",
    "style-loader": "^1.1.3",
    "stylelint": "^10.1.0",
    "stylelint-config-standard": "^18.3.0",
    "stylelint-scss": "^3.16.0",
    "stylelint-webpack-plugin": "^0.10.5",
    "webapp-webpack-plugin": "^2.7.1",
    "webpack": "^4.42.0",
    "webpack-cli": "^3.3.11",
    "webpack-merge": "^4.2.2",
    "webpackbar": "^4.0.0"
  },
  "dependencies": {
    "chalk": "^2.4.2",
    "clear": "^0.1.0",
    "enquirer": "^2.3.4",
    "figlet": "^1.3.0",
    "ftp-deploy": "^2.3.6",
    "jquery": "^3.4.1",
    "localtunnel": "^2.0.0",
    "normalize.css": "^8.0.1",
    "reset-css": "^4.0.1",
    "sanitize.css": "^11.0.0",
    "webpack-dev-server": "^3.10.3"
  }
}

...