Since Sharp is implemented based on the C++ libvips library, after the local Mac is developed, it will be compiled and installed based on the test environment Liunx platform when installing the sharp module during deployment. When installing the test environment, it will be found that github download libvips-8.9. is requested to download libvips-8.9., so it can only fail. Later, I looked at the source code and the documentation and found that the sharp project was thoughtful and preferred to use cache and sharp_dist_base_url parameters, so that libvips-8.9. can be downloaded to the intranet first.
The npm cache path is queried using npm config get cache. Create new_libvips and put libvips-8.9. in.
Using cached /root/.npm/_libvips/libvips-8.9., so that no more requests will be made during installation.
npm config set sharp_dist_base_url "https://hostname/path/"
Or SHARP_DIST_BASE_URL=http://172. npm i --unsafe-perm --allow-root
On the surface, it seems that using the above method to solve the problem of not requesting a dependency package is done, but it is far from that simple.
Since the Liunx environment is needed to install and compile sharp, I naturally thought of using a virtual machine or Docker to install and download CentOS-8.1.1911-x86_64 through Parallels Desktop. It prompts that the mirror cannot be recognized, which makes no sense.
Later, I tried many times to find that the default Linux among other options can be selected to install, but the system cannot be started. I studied to point the CD-ROM startup to CentOS-8.1.1911-x86_64 and restarted to use CDROM to start and install CentOS.
After installing the system, I thought it would be perfectly solved, so I went to npm i sharp directly. There were a bunch of errors after the matter was there, and I encountered an error in the npm installation exception. The record is as follows.
1、gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
solve:npm config set python /path/to/executable/python2.7
2、stack Error: EACCES: permission denied, mkdir
Because the user root account used to install Linux also encountered an exception prompt. To avoid this, a high-privileged user is specially built for running npm; either add the --unsafe-perm parameter so that you don't switch to nobody.
solve:npm i --unsafe-perm --allow-root
3. As mentioned earlier, since installing sharp requires compilation of C++ libvips, node-gyp is required
solve:npm install --global node-gyp
4、Error make:g++:not find
After Linux installation, there is no need to install make
solve:yum install -y make gcc-c++
5. sudo npm install prompt sudo: npm: The command cannot be found.
Since npm and node are decompressed and installed not to the system /use/bin, it is solved by soft link
solve:
ln -s /home/soft/node-v10.6.0/bin/npm /usr/bin/npm
ln -s /home/soft/node-v10.6.0/bin/np /usr/bin/node
6. Mac access Parallels Desktop virtual machine Linux
Go back to Mac to log in to Linux after querying IP using ifconfig in virtual machine
ssh root@10.
Synchronize files
Copy from local to remote
# Copy the file
scp /home/test/ [email protected]:/home/test/
# Copy directory
scp -r /home/test/ [email protected]:/home/test/
Copy from remote to local
# Copy the file
scp [email protected]:/home/test/ /home/test/
# Copy directory
scp -r [email protected]:/home/test/ v/home/test/
The above is the detailed content of the summary of the problems encountered during the installation process. For more information on the summary of the installation problem, please pay attention to my other related articles!