your_semmpai
@your_semmpai

Проблема с node-gyp?

Итак, все началось с того что при установке всех модулей постоянно происходила попытка node-gyp rebuild'а, из за этого некоторые модули не устанавливались, так же выдавало ошибку при node-gyp rebuild, вот логи с установки модуля sleep как пример:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'i',
1 verbose cli   'sleep'
1 verbose cli ]
2 info using npm@6.14.6
3 info using node@v12.18.3
4 verbose npm-session 3e345fdbd2b37b1d
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/sleep 1211ms (from cache)
8 silly pacote tag manifest for sleep@latest fetched in 1360ms
9 timing stage:loadCurrentTree Completed in 1503ms
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 timing stage:loadIdealTree:cloneCurrentTree Completed in 1ms
13 silly install loadShrinkwrap
14 timing stage:loadIdealTree:loadShrinkwrap Completed in 5ms
15 silly install loadAllDepsIntoIdealTree
16 silly resolveWithNewModule sleep@6.3.0 checking installable status
17 http fetch GET 200 https://registry.npmjs.org/nan 385ms
18 http fetch GET 200 https://registry.npmjs.org/nan/-/nan-2.14.1.tgz 446ms
19 silly pacote range manifest for nan@^2.14.1 fetched in 859ms
20 silly resolveWithNewModule nan@2.14.1 checking installable status
21 timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 875ms
22 timing stage:loadIdealTree Completed in 884ms
23 silly currentTree system32
24 silly idealTree system32
24 silly idealTree +-- nan@2.14.1
24 silly idealTree `-- sleep@6.3.0
25 silly install generateActionsToTake
26 timing stage:generateActionsToTake Completed in 11ms
27 silly diffTrees action count 2
28 silly diffTrees add nan@2.14.1
29 silly diffTrees add sleep@6.3.0
30 silly decomposeActions action count 16
31 silly decomposeActions fetch nan@2.14.1
32 silly decomposeActions extract nan@2.14.1
33 silly decomposeActions preinstall nan@2.14.1
34 silly decomposeActions build nan@2.14.1
35 silly decomposeActions install nan@2.14.1
36 silly decomposeActions postinstall nan@2.14.1
37 silly decomposeActions finalize nan@2.14.1
38 silly decomposeActions refresh-package-json nan@2.14.1
39 silly decomposeActions fetch sleep@6.3.0
40 silly decomposeActions extract sleep@6.3.0
41 silly decomposeActions preinstall sleep@6.3.0
42 silly decomposeActions build sleep@6.3.0
43 silly decomposeActions install sleep@6.3.0
44 silly decomposeActions postinstall sleep@6.3.0
45 silly decomposeActions finalize sleep@6.3.0
46 silly decomposeActions refresh-package-json sleep@6.3.0
47 silly install executeActions
48 silly doSerial global-install 16
49 verbose correctMkdir C:\Users\NoteBook\AppData\Roaming\npm-cache\_locks correctMkdir not in flight; initializing
50 verbose makeCacheDir UID & GID are irrelevant on win32
51 verbose lock using C:\Users\NoteBook\AppData\Roaming\npm-cache\_locks\staging-ecddf487eb87445c.lock for C:\Windows\system32\node_modules\.staging
52 silly doParallel extract 2
53 silly extract nan@2.14.1
54 silly extract sleep@6.3.0
55 silly tarball trying nan@^2.14.1 by hash: sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==
56 silly tarball trying sleep@latest by hash: sha512-+WgYl951qdUlb1iS97UvQ01pkauoBK9ML9I/CMPg41v0Ze4EyMlTgFTDDo32iYj98IYqxIjDMRd+L71lawFfpQ==
57 silly extract sleep@latest extracted to C:\Windows\system32\node_modules\.staging\sleep-e4e2a542 (113ms)
58 silly extract nan@^2.14.1 extracted to C:\Windows\system32\node_modules\.staging\nan-a7ee33ef (187ms)
59 timing action:extract Completed in 191ms
60 silly doReverseSerial unbuild 16
61 silly doSerial remove 16
62 silly doSerial move 16
63 silly doSerial finalize 16
64 silly finalize C:\Windows\system32\node_modules\nan
65 silly finalize C:\Windows\system32\node_modules\sleep
66 timing action:finalize Completed in 23ms
67 silly doParallel refresh-package-json 2
68 silly refresh-package-json C:\Windows\system32\node_modules\nan
69 silly refresh-package-json C:\Windows\system32\node_modules\sleep
70 timing action:refresh-package-json Completed in 375ms
71 silly doParallel preinstall 2
72 silly preinstall nan@2.14.1
73 info lifecycle nan@2.14.1~preinstall: nan@2.14.1
74 silly preinstall sleep@6.3.0
75 info lifecycle sleep@6.3.0~preinstall: sleep@6.3.0
76 timing action:preinstall Completed in 4ms
77 silly doSerial build 16
78 silly build nan@2.14.1
79 info linkStuff nan@2.14.1
80 silly linkStuff nan@2.14.1 has C:\Windows\system32\node_modules as its parent node_modules
81 silly build sleep@6.3.0
82 info linkStuff sleep@6.3.0
83 silly linkStuff sleep@6.3.0 has C:\Windows\system32\node_modules as its parent node_modules
84 timing action:build Completed in 5ms
85 silly doSerial global-link 16
86 silly doParallel update-linked 0
87 silly doSerial install 16
88 silly install nan@2.14.1
89 info lifecycle nan@2.14.1~install: nan@2.14.1
90 timing audit submit Completed in 678ms
91 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 679ms
92 silly install sleep@6.3.0
93 info lifecycle sleep@6.3.0~install: sleep@6.3.0
94 timing audit body Completed in 2ms
95 verbose lifecycle sleep@6.3.0~install: unsafe-perm in lifecycle true
96 verbose lifecycle sleep@6.3.0~install: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Windows\system32\node_modules\sleep\node_modules\.bin;C:\Windows\system32\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cmd;C:\Users\NoteBook\AppData\Local\Programs\Python\Python38-32\Scripts\;C:\Users\NoteBook\AppData\Local\Programs\Python\Python38-32\;C:\Ruby27-x64\bin;C:\Users\NoteBook\AppData\Roaming\npm;C:\Program Files\heroku\bin;c:/program files/heroku/bin;C:\Program Files\nodejs\;
97 verbose lifecycle sleep@6.3.0~install: CWD: C:\Windows\system32\node_modules\sleep
98 silly lifecycle sleep@6.3.0~install: Args: [ '/d /s /c', 'node-gyp rebuild' ]
99 silly lifecycle sleep@6.3.0~install: Returned: code: 1  signal: null
100 info lifecycle sleep@6.3.0~install: Failed to exec install script
101 timing action:install Completed in 16697ms
102 verbose unlock done using C:\Users\NoteBook\AppData\Roaming\npm-cache\_locks\staging-ecddf487eb87445c.lock for C:\Windows\system32\node_modules\.staging
103 timing stage:rollbackFailedOptional Completed in 71ms
104 timing stage:runTopLevelLifecycles Completed in 19886ms
105 silly saveTree system32
105 silly saveTree `-- sleep@6.3.0
105 silly saveTree   `-- nan@2.14.1
106 warn enoent ENOENT: no such file or directory, open 'C:\Windows\system32\package.json'
107 verbose enoent This is related to npm not being able to find a file.
108 warn system32 No description
109 warn system32 No repository field.
110 warn system32 No README data
111 warn system32 No license field.
112 verbose stack Error: sleep@6.3.0 install: `node-gyp rebuild`
112 verbose stack Exit status 1
112 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
112 verbose stack     at EventEmitter.emit (events.js:315:20)
112 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
112 verbose stack     at ChildProcess.emit (events.js:315:20)
112 verbose stack     at maybeClose (internal/child_process.js:1021:16)
112 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
113 verbose pkgid sleep@6.3.0
114 verbose cwd C:\Windows\system32
115 verbose Windows_NT 6.1.7601
116 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i" "sleep"
117 verbose node v12.18.3
118 verbose npm  v6.14.6
119 error code ELIFECYCLE
120 error errno 1
121 error sleep@6.3.0 install: `node-gyp rebuild`
121 error Exit status 1
122 error Failed at the sleep@6.3.0 install script.
122 error This is probably not a problem with npm. There is likely additional logging output above.
123 verbose exit [ 1, true ]

Ниже то как выглядела ошибка в консоли:
5f372b4cf1e5a027669334.png
Присмотревшись я увидел, что оно требует VS, так же я увидел ссылку на гитхаб, там я увидел нужную мне команду, но при попытке ввода данной команды все зависало на этом моменте...
5f372c48e00a3833475238.png
Я подумал что нужно немного подождать но спустя полчаса ничего не изменилось, я подумал что из за слабого интернета, все таки фулл VS скачивается(вроде много весит), поэтому попробовал с офлайн установщиком, вот что вышло:
5f372d04a918e826150878.png
Вот логи: https://yadi.sk/d/ljoeVZ8ebEebOg
Я не просто так описал всю проблему с самого начала, так как я не уверен что делаю правильно, помогите решить данную проблему, буду благодарен
Проблема появилась недавно, после чего не помню
  • Вопрос задан
  • 3239 просмотров
Решения вопроса 1
kocherman
@kocherman
Поставьте Visual Studio - проблемы как рукой снимет. node-gyp нужен компилятор, чтобы пересобрать себя из исходников.

Он же буржуйским языком говорит ошибку:

Не установлена переменная msvs_version (в которой должна храниться версия Visual Studio).

Тогда пытается прочитать переменную VCINSTALLDIR (в которой должен быть путь к папке установленной Visual Studio) и там неудача.

Говорит, что ни Visual Studio 2017+ ни Visual Studio 2015 не установлено. Более старые - не подойдут.
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы