Ошибка при установке углового клика глобально - PullRequest
0 голосов
/ 02 января 2019

Я новичок в этой платформе.Я использую IntelliJ Idea Ultimate Edition.Я установил узел JS версии v10.14.2.

Я попытался с помощью команды npm install -g @angular/cli Я получил следующую ошибку.

npm ERR! path C:\Users\D\AppData\Roaming\npm\ng.cmd
npm ERR! code EEXIST
npm ERR! Refusing to delete C:\Users\D\AppData\Roaming\npm\ng.cmd: node_modules\angular-cli\bin\ng symlink target is not controlled by npm C:\Users\D\AppData\Roaming\npm\node_modules\@angular\cli
npm ERR! File exists: C:\Users\D\AppData\Roaming\npm\ng.cmd
npm ERR! Move it away, and try again.

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

После того, как я попытался установить, я получаю сообщение об ошибке ниже

npm WARN deprecated angular-cli@1.0.0-beta.28.3: angular-cli has been renamed to @angular/cli. Please update your dependencies.
npm WARN deprecated exists-sync@0.0.3: Please replace with usage of fs.existsSync
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated boom@2.10.1: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated cryptiles@2.0.5: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated hoek@2.16.3: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated gulp-util@3.0.7: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
C:\Users\D\AppData\Roaming\npm\ng -> C:\Users\D\AppData\Roaming\npm\node_modules\angular-cli\bin\ng

> node-sass@4.11.0 install C:\Users\DRAJKUM3\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.11.0/win32-x64-64_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.11.0/win32-x64-64_binding.node":

tunneling socket could not be established, cause=getaddrinfo ENOTFOUND f.com f.com:8080

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g.

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

or configure npm proxy via

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

> node-sass@4.11.0 postinstall C:\Users\D\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-sass
> node scripts/build.js

Building: C:\Program Files\nodejs\node.exe C:\Users\D\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'C:\\Users\\D\\AppData\\Roaming\\npm\\node_modules\\angular-cli\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library=' ]
gyp info using node-gyp@3.8.0
gyp info using node@10.14.2 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\D\AppData\Roaming\npm\node_modules\angular-cli\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\D\AppData\Roaming\npm\node_modules\angular-cli\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\D\AppData\Roaming\npm\node_modules\angular-cli\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\D\AppData\Roaming\npm\node_modules\angular-cli\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\D\AppData\Roaming\npm\node_modules\angular-cli\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\D\AppData\Roaming\npm\node_modules\angular-cli\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:154:21)
gyp verb `which` failed  python2 { Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\DRAJKUM3\AppData\Roaming\npm\node_modules\angular-cli\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\D\AppData\Roaming\npm\node_modules\angular-cli\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\D\AppData\Roaming\npm\node_modules\angular-cli\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\D\AppData\Roaming\npm\node_modules\angular-cli\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\D\AppData\Roaming\npm\node_modules\angular-cli\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\D\AppData\Roaming\npm\node_modules\angular-cli\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:154:21)
gyp verb `which` failed   stack:
gyp verb `which` failed    'Error: not found: python2\n    at getNotFoundError (C:\\Users\\D\\AppData\\Roaming\\npm\\node_modules\\angular-cli\\node_modules\\which\\which.js:13:12)\n    at F (C:\\Users\\DRAJKUM3\\AppData\\Roaming\\npm\\node_modules\\angular-cli\\node_modules\\which\\which.js:68:19)\n    at E (C:\\Users\\DRAJKUM3\\AppData\\Roaming\\npm\\node_modules\\angular-cli\\node_modules\\which\\which.js:80:29)\n    at C:\\Users\\DRAJKUM3\\AppData\\Roaming\\npm\\node_modules\\angular-cli\\node_modules\\which\\which.js:89:16\n    at C:\\Users\\DRAJKUM3\\AppData\\Roaming\\npm\\node_modules\\angular-cli\\node_modules\\isexe\\index.js:42:5\n    at C:\\Users\\DRAJKUM3\\AppData\\Roaming\\npm\\node_modules\\angular-cli\\node_modules\\isexe\\windows.js:36:5\n    at FSReqWrap.oncomplete (fs.js:154:21)',
gyp verb `which` failed   code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:\Users\D\AppData\Local\Programs\Python\Python37-32\python.EXE
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\D\AppData\Local\Programs\Python\Python37-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\D\\AppData\\Roaming\\npm\\node_modules\\angular-cli\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\D\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-sass
gyp ERR! node -v v10.14.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN @angular/core@2.4.10 requires a peer of rxjs@^5.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\angular-cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.11.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.11.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Я уже установил PYTHON и установил его в переменные env.Я сделал то же самое для GIT.

EDIT2 Ошибка в процессе сборки

The projects in this solution are created one after the other. To enable a parallel creation, you must add the "/ m" switch.
The build process was started on 02.01.2019 14:34:39.
Project "C: \ Users \ D \ IdeaProjects \ AngularHelloWorld \ helloworld \ node_modules \ node-sass \ build \ binding.sln" on node "1" (default destinations).
ValidateSolutionConfiguration:
The solution configuration "Release | x64" is created.
MSBUILD: error MSB3428: Could not load Visual C ++ component VCBuild.exe. To fix this problem, install either 1) the .NET Framework 2.0 SDK or 2) Microsoft Visual Studio 2005 or 3) add the location of the component m Add system path if it is different from the default location. [C: \ Users \ D \ Idea Projects \ AngularHelloWorld \ helloworld \ node_modules \ node-sass \ build \ binding.sln]
Creation of the project "C: \ Users \ D \ IdeaProjects \ AngularHelloWorld \ helloworld \ node_modules \ node-sass \ build \ binding.sln" is complete (default targets) - ERROR.


Error during the build process.

The projects in this solution are created one after the other. To enable a parallel creation, you must add the "/ m" switch.
The build process was started on 02.01.2019 14:34:39.
Project "C: \ Users \ D \ IdeaProjects \ AngularHelloWorld \ helloworld \ node_modules \ node-sass \ build \ binding.sln" on node "1" (default destinations).
ValidateSolutionConfiguration:
The solution configuration "Release | x64" is created.
MSBUILD: error MSB3428: Could not load Visual C ++ component VCBuild.exe. To fix this problem, install either 1) the .NET Framework 2.0 SDK or 2) Microsoft Visual Studio 2005 or 3) add the location of the component
m Add system path if it is different from the default location. [C: \ Users \ D \ Idea Projects \ AngularHelloWorld \ helloworld \ node_modules \ node-sass \ build \ binding.sln]
Creation of the project "C: \ Users \ D \ IdeaProjects \ AngularHelloWorld \ helloworld \ node_modules \ node-sass \ build \ binding.sln" is complete (default targets) - ERROR.

    Error during the build process.

    "C: \ Users \ D \ IdeaProjects \ AngularHelloWorld \ helloworld \ node_modules \ node-sass \ build \ binding.sln" (default destination) (1) ->
    (_src_ \ libsass destination) ->
      MSBUILD: error MSB3428: Could not load Visual C ++ component VCBuild.exe. To fix this problem, install either 1) .NET Framework 2.0 SDK or 2) Microsoft Visual Studio 2005 or 3) add the location of the component
    to the system path if it differs from the default location. [C: \ Users \ D \ Idea Projects \ AngularHelloWorld \ helloworld \ node_modules \ node-sass \ build \ binding.sln]

Ответы [ 2 ]

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

Похоже, вы используете Python 3.x

...
Error: Command failed: C:\Users\D\AppData\Local\Programs\Python\Python37-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
...

node-gyp документация говорит, что Python 3.x не поддерживается https://github.com/nodejs/node-gyp

Попробуйте полностью удалить Python и установить v2.7

UPD:

Зачем вам вообще нужно node-gyp? Если вы посмотрите на строки

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.11.0/win32-x64-64_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.11.0/win32-x64-64_binding.node":

вы увидите, что ваша установка пытается загрузить готовую версию node-sass для вашей среды, но не удается. После этого программа загрузит node-sass исходников и создаст их в режиме ad-hoc. Для этого шага требуется node-gyp, который будет установлен и готов к использованию.

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

Шаги для Windows:

  1. Первый узел проверки Последняя версия JS установлена ​​правильно или нет по команде

    node --version

Затем выполните следующие шаги:

> npm uninstall -g @angular/cli
> npm cache clean
> npm install -g @angular/cli
...