基本参照github官网就行。
主要问题:
1:总是报preinstall error --重新下载vscode源码,可能被破坏了。
2:个别module下载不下来 --通过yarn add 手动下载可以搞定。
3: if not defined npm_config_node_gyp 好像是编译无法通过,我通过尝试使用不同版本的node解决了 测试10通过了
4:yarn The platform “win32” is incompatible with this module
解决:yarn config set ignore-engines true
错误记录如下:
$ yarn install
yarn install v1.22.4
$ node build/npm/preinstall.js
[1/4] Resolving packages…
[2/4] Fetching packages…
info [email protected]: The platform “win32” is incompatible with this module.
info “[email protected]” is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform “win32” is incompatible with this module.
info “[email protected]” is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform “win32” is incompatible with this module.
info “[email protected]” is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies…
warning " > [email protected]" has incorrect peer dependency “typescript@^3.0.0”.
[4/4] Building fresh packages…
$ node build/npm/postinstall.js
Installing dependencies in extensions…
$ yarn
yarn install v1.22.4
warning package.json: No license field
warning [email protected]: No license field
[1/4] Resolving packages…
[2/4] Fetching packages…
[3/4] Linking dependencies…
[4/4] Building fresh packages…
$ node ./postinstall
Removed D:\projects\vscode-master\extensions\node_modules\typescript\AUTHORS.md
Removed D:\projects\vscode-master\extensions\node_modules\typescript\bin
Removed D:\projects\vscode-master\extensions\node_modules\typescript\CODE_OF_CONDUCT.md
Removed D:\projects\vscode-master\extensions\node_modules\typescript\CopyrightNotice.txt
Removed D:\projects\vscode-master\extensions\node_modules\typescript\LICENSE.txt
Removed D:\projects\vscode-master\extensions\node_modules\typescript\loc
Removed D:\projects\vscode-master\extensions\node_modules\typescript\README.md
Removed D:\projects\vscode-master\extensions\node_modules\typescript\ThirdPartyNoticeText.txt
removed ‘D:\projects\vscode-master\extensions\node_modules\typescript\lib\tsc.js’
removed ‘D:\projects\vscode-master\extensions\node_modules\typescript\lib\tsserverlibrary.d.ts’
removed ‘D:\projects\vscode-master\extensions\node_modules\typescript\lib\tsserverlibrary.js’
removed ‘D:\projects\vscode-master\extensions\node_modules\typescript\lib\typescriptServices.d.ts’
removed ‘D:\projects\vscode-master\extensions\node_modules\typescript\lib\typescriptServices.js’
Done in 5.45s.
Installing dependencies in remote…
$ yarn
yarn install v1.22.4
warning package.json: No license field
warning [email protected]: No license field
[1/4] Resolving packages…
[2/4] Fetching packages…
info [email protected]: The platform “win32” is incompatible with this module.
info “[email protected]” is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies…
[4/4] Building fresh packages…
error D:\projects\vscode-master\remote\node_modules\native-watchdog: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: D:\projects\vscode-master\remote\node_modules\native-watchdog
Output:
D:\projects\vscode-master\remote\node_modules\native-watchdog>if not defined npm_config_node_gyp (node “C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\…\node_modules\node-gyp\bin\node-gyp.js” rebuild ) else (node “” rebuild )
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info find Python using Python version 2.7.15 found at “C:\Users\sumtr.windows-build-tools\python27\python.exe”
gyp http GET http://nodejs.org/dist/v12.4.0/node-v12.4.0-headers.tar.gz
gyp http 200 http://nodejs.org/dist/v12.4.0/node-v12.4.0-headers.tar.gz
gyp http GET http://nodejs.org/dist/v12.4.0/SHASUMS256.txt
gyp http GET http://nodejs.org/dist/v12.4.0/win-x86/node.lib
gyp http GET http://nodejs.org/dist/v12.4.0/win-arm64/node.lib
gyp http GET http://nodejs.org/dist/v12.4.0/win-x64/node.lib
gyp http 200 http://nodejs.org/dist/v12.4.0/win-x86/node.lib
gyp http 404 http://nodejs.org/dist/v12.4.0/win-arm64/node.lib
gyp http 200 http://nodejs.org/dist/v12.4.0/SHASUMS256.txt
gyp http 200 http://nodejs.org/dist/v12.4.0/win-x64/node.lib
gyp info find VS using VS2015 (14.0) found at:
gyp info find VS “C:\Program Files (x86)\Microsoft Visual Studio 14.0”
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Users\sumtr.windows-build-tools\python27\python.exe
gyp info spawn args [
gyp info spawn args ‘D:\programfiles\nvm\v12.16.3\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py’,
gyp info spawn args ‘binding.gyp’,
gyp info spawn args ‘-f’,
gyp info spawn args ‘msvs’,
gyp info spawn args ‘-I’,
gyp info spawn args ‘D:\projects\vscode-master\remote\node_modules\native-watchdog\build\config.gypi’,
gyp info spawn args ‘-I’,
gyp info spawn args ‘D:\programfiles\nvm\v12.16.3\node_modules\npm\node_modules\node-gyp\addon.gypi’,
gyp info spawn args ‘-I’,
gyp info spawn args ‘C:\Users\sumtr\AppData\Local\node-gyp\Cache\12.4.0\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\sumtr\AppData\Local\node-gyp\Cache\12.4.0’,
gyp info spawn args ‘-Dnode_gyp_dir=D:\programfiles\nvm\v12.16.3\node_modules\npm\node_modules\node-gyp’,
gyp info spawn args ‘-Dnode_lib_file=C:\\Users\\sumtr\\AppData\\Local\\node-gyp\\Cache\\12.4.0\\<(target_arch)\\node.lib’,
gyp info spawn args ‘-Dmodule_root_dir=D:\projects\vscode-master\remote\node_modules\native-watchdog’,
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 ‘D:\projects\vscode-master\remote\node_modules\native-watchdog\build’,
gyp info spawn args ‘-Goutput_dir=.’
gyp info spawn args ]
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args ‘build/binding.sln’,
gyp info spawn args ‘/clp:Verbosity=minimal’,
gyp info spawn args ‘/nologo’,
gyp info spawn args ‘/p:Configuration=Release;Platform=x64’
gyp info spawn args ]
�ڴ˽��������һ������һ����Ŀ����Ҫ���ò������ɣ������ӡ�/m�����ء�
watchdog.cc
win_delay_load_hook.cc
LINK : fatal error LNK1104: cannot open file ‘C:\Users\sumtr\AppData\Local\node-gyp\Cache\12.4.0\x64\node.lib’ [D:\projects\vscode-master\remote\node_modules\native-watchdog\build\watchdog.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe
failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (D:\programfiles\nvm\v12.16.3\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:310:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js” “rebuild”
gyp ERR! cwd D:\projects\vscode-master\remote\node_modules\native-watchdog
gyp ERR! node -v v12.16.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
sumtr@DESKTOP-PORTKGS MINGW64 /d/projects/vscode-master
$
sumtr@DESKTOP-PORTKGS MINGW64 /d/projects/vscode-master
$ yarn config set ignore-engines true
yarn config v1.22.4
success Set “ignore-engines” to “true”.
Done in 0.09s.