Ошибка установки angular / cli в macOS mojave - node-pre-gyp - PullRequest
0 голосов
/ 24 января 2019

Я форматирую свой imac и удаляю все файлы на HD.Однако, когда я устанавливаю Angle Cli 7, консоль терминала показывает этот журнал ошибок.

Окружающая среда

macOS: узел Mojave 10.14.2: v10.15 npm: 6.4.1


Ошибка консоли

miguels-imac:~ makito$ sudo npm install -g @angular/cli
/usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng

> fsevents@1.2.7 install 
/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents
> node install

node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for fsevents@1.2.7 
and node@10.15.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/lib'
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/build'
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/Cellar/node@10/10.15.0/bin/node" "/usr/local/Cellar/node@10/10.15.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" "--module_name=fse" "--module_path=/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /usr/local/lib/node_modules/@angular/cli/node_modules/fsevents
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node@10/10.15.0/bin/node /usr/local/Cellar/node@10/10.15.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node --module_name=fse --module_path=/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Darwin 18.2.0
node-pre-gyp ERR! command "/usr/local/Cellar/node@10/10.15.0/bin/node" "/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/@angular/cli/node_modules/fsevents
node-pre-gyp ERR! node -v v10.15.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/Cellar/node@10/10.15.0/bin/node /usr/local/Cellar/node@10/10.15.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node --module_name=fse --module_path=/usr/local/lib/node_modules/@angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/@angular/cli/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 install: `node install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ @angular/cli@7.2.3
added 294 packages from 178 contributors in 20.637s

ifя показываю глобальные зависимости, у меня есть @ angular / cli ... так, почему эта ошибка?, что я делаю неправильно?.

поиск в stackOverflow, я решаю установить node-pre-gyp и установить xCode.но ничего не изменится.

Ответы [ 3 ]

0 голосов
/ 25 января 2019

Ну, я сделал это, и у меня это сработало.

  1. rm -rf / usr / local / lib / node_modules
  2. узел удаления brew
  3. узел установки brew --without-npm
  4. echo prefix = ~ / .npm-packages >> ~ / .npmrc
  5. завиток -L https://www.npmjs.com/install.sh | ш
  6. добавьте следующую строку в ваш ~ / .bash_profile (экспорт PATH = "$ HOME / .npm-packages / bin: $ PATH")

  7. Удалите ваш текущий @ angular / cli (sudo npm uninstall -g @ angular / cli)

  8. очистка кэша npm - проверка силы / npm кэша
  9. xcode-select --install
  10. npm install -g node-gyp
  11. npm install -g @ angular / cli (без sudo).

Дайте мне знать, если это работает

0 голосов
/ 22 февраля 2019

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

Я запустил ng v и увидел, что установлена ​​новая версия.

Похожая проблема зарегистрирована здесь https://github.com/aws-amplify/amplify-cli/issues/783

0 голосов
/ 25 января 2019

Вы не делаете ничего плохого, есть некоторая ошибка, связанная с (вероятно) fsevents, как с официальным пакетом из node.js (lts и current), так и с установками homebrew.

Следуйте за ответами наэтот поток: Как мне полностью удалить Node.js и переустановить с самого начала (Mac OS X)

[в основном вам нужно вручную удалять файлы, папки и папки npm, ng]

и установите nvm, а затем узел с nvm.

...