Tag Archives: Mac

Mac download wepy error reporting solution

Today when downloading wepy-cli an error was reported

sudo npm i wepy-cli -g

gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/wepy-cli/node_modules/fsevents/.node-gyp'
gyp ERR! System Darwin 19.2.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/wepy-cli/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node" "--module_name=fse" "--module_path=/usr/local/lib/node_modules/wepy-cli/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /usr/local/lib/node_modules/wepy-cli/node_modules/fsevents
gyp ERR! node -v v12.13.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/wepy-cli/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node --module_name=fse --module_path=/usr/local/lib/node_modules/wepy-cli/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/wepy-cli/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)

 

I said I didn’t have permission. Why?I added sudo

After tossing for a long time, I found an order

sudo npm install –unsafe-perm -g wepy-cli

That’s it

Why

A: for security reasons, NPM does not support running as root. Even if you run as root, NPM will automatically turn into a user named nobody, who has almost no permissions. In this way, if your script has some operations that require permissions, such as writing files (especially/root /. Node gyp), it will crash

In order to avoid this situation, either follow the rules of NPM and set up a high authority user for running NPM; Either add the — unsafe perm parameter, so that you will not switch to nobody. The user at runtime is the same user, even root

 

Error in installing MySQL Python on MAC [Solved]

Error Message:

EnvironmentError: mysql_config not found

Command “python setup.py egg_info” failed with error code 1 in /private/var/folders/nh/j05szmpj19368dd9_y6whgy40000gq/T/pip-install-n9Jonx/mysql-python/

I looked up the command to execute an environment variable online:

export PATH=$PATH:/usr/local/mysql/bin

Then another error was reported:

#include “my_config.h”
^~~~~~~~~~~~~
1 error generated.
error: command ‘cc’ failed with exit status 1

Finally, I used two methods

One is to first execute :

brew install mysql

Be sure to install through brew

Second, download directly:

https://dev.mysql.com/downloads/connector/python/

After downloading, you can access:

/ usr/local/mysql/bin    In this folder, you can see that there is a file called mysql_Config file

 

Since I did both things at the same time, I can’t judge which is right and which is wrong, or both, and then execute it again:

export PATH=$PATH:/usr/local/mysql/bin

Latest run: Good install MySQL-Python

 

Error in connecting to MySQL via Navicat on MAC

After installing MySQL on the Mac, connect with Navicat, and a connection failure error will pop up in the connection test:

Client does not support authentication protocol requested by server; consider upgrading MySQL client

 

Find the following solutions online:

1.mysql -u root -p 2.use mysql; 3.alter user 'root'@'localhost' identified with mysql_native_password by '11111111'; 4.flush privileges;

explain:

    1. Root is the user name, localhost is the IP address 127.0.0.1, especially the local machine, mysql_native_Password is the old password verification mechanism, followed by the password for MySQL.

    2. Flush privileges: refresh the system permission related tables of MySQL.

 

As shown in the figure:

Back to Navicat, the personal test is successful!

 

Postscript: some netizens said that the new version would report this error. The MySQL I installed is the latest version 8.0.13. I don’t know if this is the reason.

Error reporting when installing r reference rjava on MAC

      Recently, I want to learn that R installed an R and rstudio yesterday. After the installation, I wanted to find an exercise to deal with Excel, so I found an xlsx package and reported errors all the time, as shown in the following figure:

     

      After a day of trouble, I still haven’t solved it. Finally, I found a solution online, so I recorded it. I hope it will be useful to other people with the same problem

    Solution: execute the command on the MAC terminal:   sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib

Then execute in rstudio     library(“xlsx”)    

      

 

    Referenced address:   https://stackoverflow.com/questions/30738974/rjava-load-error-in-rstudio-r-after-upgrading-to-osx-yosemite

Solve the problem of ADB: command not found on MAC

Programmer algorithm practice must read, common Java API skills to share>>>

When using MAC for development, sometimes you need to use the ADB instruction to perform some operations. However, if you have not configured the Android environment variables, you may encounter the problem of ADB: command not found. After checking some information, here is a record of how to configure the Android environment variables on Mac

Open the terminal terminal of the Mac and enter Cd ~/[enter the home directory of the current user]

Enter touch. Bash_ Profile [if not. Bash_ Profile, create a file]

Enter open. Bash_ Open the file we created, and a text edit box will pop up. If the environment is configured for the first time, the text edit box will be blank

Write the following code in the open text editor:

export ANDROID_HOME=/usr/local/opt/android-sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools

Note the Android in 4_ Home should be filled in according to its own SDK path, and the rest can be copied directly. As for the SDK path, you can open Android studio and search the SDK in preference (Windows setting) to view it

Enter source. Bash in the terminal_ Profile [make our changes effective]

Enter ADB [verify whether the configuration is completed. If the ADB: command not found is not displayed, the configuration is completed]

“Amd action: authenticate: SP” appears when MAC updates Xcode

Programmer algorithm practice must read, common Java API skills to share>>>

Error updating Xcode in app store, pop-up window shows: AMD action: authenticate: sp

Reason: I have two hard disks, one SSD, as the system disk; Another mechanical hard disk for data. In addition, the users directory is moved to the mechanical disk, and a soft connection is created on the SSD to point to users – because the users directory is too large for SSD. According to the analysis of the information obtained from Google, the reason is that the library directory is not on the SSD (system disk), which leads to this error

Solution:

1. First, find out the biggest folders in the users directory (a bit like tuning for “bottleneck”) – in my case, the library/Android folder. There are so many things in the SDK that exceed 40Gb – move them to another part of the mechanical disk and create a soft connection in the original location

2. Delete the soft connection to users on SSD

3. Copy the users directory back to the SSD hard disk; Because the biggest Android is no longer under users, SSD can accommodate it

4. Restart, update Xcode, success

Mac: Python Install lxml Error: Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed

Failed to install lxml

#include “libxml/xpath.h”
^
1 error generated.
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
Perhaps try: xcode-select –install
*********************************************************************************
error: command ‘cc’ failed with exit status 1

After installing libxml2, I still prompted this error, and finally found the problem after a lot of trouble

Need to add C_ INCLUDE_ Path to the libxml2 path in Xcode MacOS SDKs

sudo C_ INCLUDE_ PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2/

And then in execution

xcode-select --install
pip install lxml

How to Solve Mac Sed Error: command c expects followed by text

A very simple command to replace text:

1 sed -i 's/www.a.cn/www.b.com/g' common.sh

Command C expectations following by text
may also report invalid command code W

But the same command can be executed correctly on the server. See the explanation in the – I option of man sed under Mac

-i extension
             Edit files in-place, saving backups with the specified extension.  If a zero-length extension is given, no backup will be
             saved.  It is not recommended to give a zero-length extension when in-place editing files, as you risk corruption or par-
             tial content in situations where disk space is exhausted, etc.

The general meaning is that Mac will force backup when using – I option, so you must give a suffix to backup. If you don’t want to backup, you can use empty character directly

1 sed -i 's/www.a.cn/www.b.com/g' common.sh

[Solved] Use of create react app on Mac platform (command not found)

 

You are able to apply the following solution:

$ npm config set prefix /usr/local
$ sudo npm install -g create-react-app
$ create-react-app my-app

Use of create react app on Mac platform (command not found)

Labels (space delimited): react


Before the beginning of BB: as a new front-end Xiaobai, in order to self-study front-end bought some books to see, half a year later. If you think you have achieved the right result, you can kill all the people. However, it turns out that there are people outside, there is a day outside, and I am still the original Xiaobai… So I planned to practice again. Who would have met the pit in the first step

Gorgeous dividing line


Problem Description:

Today, in the process of learning react, the first thing is to build the environment (Environment Building Article). After browsing the above link article, I found that there are two ways to build the react environment. The first one is relatively simple, so I decided to use the first one to build the environment. But who would have thought that there was a problem:

“`shell

create-react-app hello

“`

After executing the above code, create react app: command not found is returned with an error, which means that the command does not exist

Thinking process:

At first glance, I thought it might be that it was not installed in the global environment, so I deleted it first, and then passed it

“`shell

npm install -g create-react-app

“`

I thought it was this problem, but the result is still abnormal

After consulting the data and looking at the NPM documents, I found that the NPM install – G command installed the module in the/usr/local/lib directory by default. So I went to the directory to find out whether the create react app module was successfully installed

How to Solve Error using brew install opencv in MAC

First, check the brew update upgrade information

brew update –verbose –force

fatal: Needed a single revision

Previously modified the source, resulting in 416, GIT update failed

Reset all sources

Reset brew.git:
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git

Reset homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git

brew update –verbose –force

then

Updating /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask...
fatal: Needed a single revision

need to goto /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask

git pull 
From https://github.com/Caskroom/homebrew-cask
 * branch                  HEAD       -> FETCH_HEAD

Re-execute brew update to restore normal.

Continue brew search opencv2

to find 2 libraries normally.

brew install opencv@2