Repository: GoogleChrome/lighthouse-ci

Issue #488: `yarn install` failed on Ubuntu:20.04
Created: 2020-11-11T14:42:44Z
I'm having trouble yarn install falied on Ubuntu:20.04.
This is because Python2 has been removed from Ubuntu:20.04 and parcel-builder@1 depends on native module deasync.
I think this is a problem that can't be fixed right now.
this comment said deasync in Parcel 2  will be removed from dependency.
So, I think parcel-builder will be updated when Parcel 2 is released.
It is steps to reproduce.
$ docker run --rm -it ubuntu:20.04

root:/# apt update
root:/# apt install build-essential git curl -y
root:/# curl -Ls "https://nodejs.org/dist/v14.15.0/node-v14.15.0-linux-x64.tar.gz" -o "node-v14.15.0-linux-x64.tar.gz"
root:/# tar -C /usr/local --strip-components 1 -xzf node-v14.15.0-linux-x64.tar.gz
root:/# npm install -g yarn
root:/# git clone https://github.com/GoogleChrome/lighthouse-ci.git
root:/# cd lighthouse-ci
root:/lighthouse-ci# yarn install

error /lighthouse-ci/node_modules/deasync: Command failed.                                                                                                                                                                                                                                                                                           
Exit code: 1                                                                                                                                                                                                                                                                                                                                         
Command: node ./build.js                                                                                                                                                                                                                                                                                                                             
Arguments:                                                                                                                                                                                                                                                                                                                                           
Directory: /lighthouse-ci/node_modules/deasync                                                                                                                                                                                                                                                                                                       
Output:                                                                                                                                                                                                                                                                                                                                              
gyp info it worked if it ends with ok                                                                                                                                                                                                                                                                                                                
gyp info using node-gyp@5.0.3                                                                                                                                                                                                                                                                                                                        
gyp info using node@14.15.0 | linux | x64                                                                                                                                                                                                                                                                                                            
gyp ERR! find Python                                                                                                                                                                                                                                                                                                                                 
gyp ERR! find Python Python is not set from command line or npm configuration                                                                                                                                                                                                                                                                        
gyp ERR! find Python Python is not set from environment variable PYTHON                                                                                                                                                                                                                                                                              
gyp ERR! find Python checking if "python" can be used                                                                                                                                                                                                                                                                                                
gyp ERR! find Python - "python" is not in PATH or produced an error                                                                                                                                                                                                                                                                                  
gyp ERR! find Python checking if "python2" can be used                                                                                                                                                                                                                                                                                               
gyp ERR! find Python - "python2" is not in PATH or produced an error                                                                                                                                                                                                                                                                                 
gyp ERR! find Python                                                                                                                                                                                                                                                                                                                                 
gyp ERR! find Python **********************************************************                                                                                                                                                                                                                                                                      
gyp ERR! find Python You need to install the latest version of Python 2.7.                                                                                                                                                                                                                                                                           
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,                                                                                                                                                                                                                                                                         
gyp ERR! find Python you can try one of the following options:                                                                                                                                                                                                                                                                                       
gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"                                                                                                                                                                                                                                                                           
gyp ERR! find Python   (accepted by both node-gyp and npm)                                                                                                                                                                                                                                                                                           
gyp ERR! find Python - Set the environment variable PYTHON                                                                                                                                                                                                                                                                                           
gyp ERR! find Python - Set the npm configuration variable python:                                                                                                                                                                                                                                                                                    
gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"                                                                                                                                                                                                                                                                             
gyp ERR! find Python For more information consult the documentation at:                                                                                                                                                                                                                                                                              
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation                                                                                                                                                                                                                                                                                 
gyp ERR! find Python **********************************************************                                                                                                                                                                                                                                                                      
gyp ERR! find Python                                                                                                                                                                                                                                                                                                                                 
gyp ERR! configure error                                                                                                                                                                                                                                                                                                                             
gyp ERR! stack Error: Could not find any Python installation to use                                                                                                                                                                                                                                                                                  
gyp ERR! stack     at PythonFinder.fail (/lighthouse-ci/node_modules/node-gyp/lib/find-python.js:303:47)                                                                                                                                                                                                                                             
gyp ERR! stack     at PythonFinder.runChecks (/lighthouse-ci/node_modules/node-gyp/lib/find-python.js:132:21)                                                                                                                                                                                                                                        
gyp ERR! stack     at PythonFinder.<anonymous> (/lighthouse-ci/node_modules/node-gyp/lib/find-python.js:175:16)                                                                                                                                                                                                                                      
gyp ERR! stack     at PythonFinder.execFileCallback (/lighthouse-ci/node_modules/node-gyp/lib/find-python.js:267:16)                                                                                                                                                                                                                                 
gyp ERR! stack     at exithandler (child_process.js:315:5)                                                                                                                                                                                                                                                                                           
gyp ERR! stack     at ChildProcess.errorhandler (child_process.js:327:5)                                                                                                                                                                                                                                                                             
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)                                                                                                                                                                                                                                                                                           
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)                                                                                                                                                                                                                                                         
gyp ERR! stack     at onErrorNT (internal/child_process.js:465:16)                                                                                                                                                                                                                                                                                   
gyp ERR! stack     at processTicksAndRejections (internal/process/task_queues.js:80:21)                                                                                                                                                                                                                                                              
gyp ERR! System Linux 5.4.0-53-generic                                                                                                                                                                                                                                                                                                               
gyp ERR! command "/usr/local/bin/node" "/lighthouse-ci/node_modules/.bin/node-gyp" "rebuild"                                                                                                                                                                                                                                                         
gyp ERR! cwd /lighthouse-ci/node_modules/deasync                                                                                                                                                                                                                                                                                                     
gyp ERR! node -v v14.15.0   

Workaround (parcel-builder)
In this case, sqlite3 will fail to install.
root:/lighthouse-ci# apt install python2 -y
root:/lighthouse-ci# python2 --version
Python 2.7.18
root:/lighthouse-ci# yarn install

error /lighthouse-ci/node_modules/deasync: Command failed.
Exit code: 1
Command: node ./build.js
Arguments: 
Directory: /lighthouse-ci/node_modules/deasync
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@5.0.3
gyp info using node@14.15.0 | linux | x64
gyp info find Python using Python version 2.7.18 found at "/usr/bin/python2"
gyp http GET https://nodejs.org/download/release/v14.15.0/node-v14.15.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v14.15.0/node-v14.15.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v14.15.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v14.15.0/SHASUMS256.txt
gyp info spawn /usr/bin/python2
gyp info spawn args [
gyp info spawn args   '/lighthouse-ci/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/lighthouse-ci/node_modules/deasync/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/lighthouse-ci/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.cache/node-gyp/14.15.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=/root/.cache/node-gyp/14.15.0',
gyp info spawn args   '-Dnode_gyp_dir=/lighthouse-ci/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/14.15.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/lighthouse-ci/node_modules/deasync',
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   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp ERR! build error 
gyp ERR! stack Error: not found: make
gyp ERR! stack     at getNotFoundError (/lighthouse-ci/node_modules/which/which.js:13:12)
gyp ERR! stack     at F (/lighthouse-ci/node_modules/which/which.js:68:19)
gyp ERR! stack     at E (/lighthouse-ci/node_modules/which/which.js:80:29)
gyp ERR! stack     at /lighthouse-ci/node_modules/which/which.js:89:16
gyp ERR! stack     at /lighthouse-ci/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /lighthouse-ci/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:183:21)
gyp ERR! System Linux 5.4.0-53-generic
gyp ERR! command "/usr/local/bin/node" "/lighthouse-ci/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /lighthouse-ci/node_modules/deasync
gyp ERR! node -v v14.15.0
Workaround (sqlite3)
root:/lighthouse-ci# update-alternatives --install /usr/bin/python python /usr/bin/python2 1
root:/lighthouse-ci# python --version
Python 2.7.18

root:/lighthouse-ci# yarn install

Duplicate issue #490: Upgrade to parcel v2 to solve Ubuntu 20 build failure
Created: 2020-11-12T03:45:21Z
I'm having trouble yarn install falied on Ubuntu:20.04.
This is because Python2 has been removed from Ubuntu:20.04 and parcel-builder@1 depends on native module deasync.
I think this is a problem that can't be fixed right now.
this comment said deasync in Parcel 2  will be removed from dependency.
So, I think parcel-builder will be updated when Parcel 2 is released.
It is steps to reproduce.
$ docker run --rm -it ubuntu:20.04

root:/# apt update
root:/# apt install build-essential git curl -y
root:/# curl -Ls "https://nodejs.org/dist/v14.15.0/node-v14.15.0-linux-x64.tar.gz" -o "node-v14.15.0-linux-x64.tar.gz"
root:/# tar -C /usr/local --strip-components 1 -xzf node-v14.15.0-linux-x64.tar.gz
root:/# npm install -g yarn
root:/# git clone https://github.com/GoogleChrome/lighthouse-ci.git
root:/# cd lighthouse-ci
root:/lighthouse-ci# yarn install

error /lighthouse-ci/node_modules/deasync: Command failed.                                                                                                                                                                                                                                                                                           
Exit code: 1                                                                                                                                                                                                                                                                                                                                         
Command: node ./build.js                                                                                                                                                                                                                                                                                                                             
Arguments:                                                                                                                                                                                                                                                                                                                                           
Directory: /lighthouse-ci/node_modules/deasync                                                                                                                                                                                                                                                                                                       
Output:                                                                                                                                                                                                                                                                                                                                              
gyp info it worked if it ends with ok                                                                                                                                                                                                                                                                                                                
gyp info using node-gyp@5.0.3                                                                                                                                                                                                                                                                                                                        
gyp info using node@14.15.0 | linux | x64                                                                                                                                                                                                                                                                                                            
gyp ERR! find Python                                                                                                                                                                                                                                                                                                                                 
gyp ERR! find Python Python is not set from command line or npm configuration                                                                                                                                                                                                                                                                        
gyp ERR! find Python Python is not set from environment variable PYTHON                                                                                                                                                                                                                                                                              
gyp ERR! find Python checking if "python" can be used                                                                                                                                                                                                                                                                                                
gyp ERR! find Python - "python" is not in PATH or produced an error                                                                                                                                                                                                                                                                                  
gyp ERR! find Python checking if "python2" can be used                                                                                                                                                                                                                                                                                               
gyp ERR! find Python - "python2" is not in PATH or produced an error                                                                                                                                                                                                                                                                                 
gyp ERR! find Python                                                                                                                                                                                                                                                                                                                                 
gyp ERR! find Python **********************************************************                                                                                                                                                                                                                                                                      
gyp ERR! find Python You need to install the latest version of Python 2.7.                                                                                                                                                                                                                                                                           
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,                                                                                                                                                                                                                                                                         
gyp ERR! find Python you can try one of the following options:                                                                                                                                                                                                                                                                                       
gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"                                                                                                                                                                                                                                                                           
gyp ERR! find Python   (accepted by both node-gyp and npm)                                                                                                                                                                                                                                                                                           
gyp ERR! find Python - Set the environment variable PYTHON                                                                                                                                                                                                                                                                                           
gyp ERR! find Python - Set the npm configuration variable python:                                                                                                                                                                                                                                                                                    
gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"                                                                                                                                                                                                                                                                             
gyp ERR! find Python For more information consult the documentation at:                                                                                                                                                                                                                                                                              
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation                                                                                                                                                                                                                                                                                 
gyp ERR! find Python **********************************************************                                                                                                                                                                                                                                                                      
gyp ERR! find Python                                                                                                                                                                                                                                                                                                                                 
gyp ERR! configure error                                                                                                                                                                                                                                                                                                                             
gyp ERR! stack Error: Could not find any Python installation to use                                                                                                                                                                                                                                                                                  
gyp ERR! stack     at PythonFinder.fail (/lighthouse-ci/node_modules/node-gyp/lib/find-python.js:303:47)                                                                                                                                                                                                                                             
gyp ERR! stack     at PythonFinder.runChecks (/lighthouse-ci/node_modules/node-gyp/lib/find-python.js:132:21)                                                                                                                                                                                                                                        
gyp ERR! stack     at PythonFinder.<anonymous> (/lighthouse-ci/node_modules/node-gyp/lib/find-python.js:175:16)                                                                                                                                                                                                                                      
gyp ERR! stack     at PythonFinder.execFileCallback (/lighthouse-ci/node_modules/node-gyp/lib/find-python.js:267:16)                                                                                                                                                                                                                                 
gyp ERR! stack     at exithandler (child_process.js:315:5)                                                                                                                                                                                                                                                                                           
gyp ERR! stack     at ChildProcess.errorhandler (child_process.js:327:5)                                                                                                                                                                                                                                                                             
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)                                                                                                                                                                                                                                                                                           
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)                                                                                                                                                                                                                                                         
gyp ERR! stack     at onErrorNT (internal/child_process.js:465:16)                                                                                                                                                                                                                                                                                   
gyp ERR! stack     at processTicksAndRejections (internal/process/task_queues.js:80:21)                                                                                                                                                                                                                                                              
gyp ERR! System Linux 5.4.0-53-generic                                                                                                                                                                                                                                                                                                               
gyp ERR! command "/usr/local/bin/node" "/lighthouse-ci/node_modules/.bin/node-gyp" "rebuild"                                                                                                                                                                                                                                                         
gyp ERR! cwd /lighthouse-ci/node_modules/deasync                                                                                                                                                                                                                                                                                                     
gyp ERR! node -v v14.15.0   

Workaround (parcel-builder)
root:/lighthouse-ci# apt install python2 -y
root:/lighthouse-ci# python2 --version
Python 2.7.18
root:/lighthouse-ci# yarn install
Ref: #488

Closing comment (2020-11-12T03:47:55Z): This appears to be an exact duplicate of #488 @koh110. was #489 not the fix you hoped it was?