Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
268 views
in Technique[技术] by (71.8m points)

javascript - I can't create react apps! canvas related issues

My laptop is M1 macbook pro. The node version is 15.4.1. The npm version is 7.0.15.

After I used this cmd npx create-react-app my-app, it returned this:

I've tried a lot, but always got the same issue. I think the problem is with "canvas". But I have no idea how to solve it.

Thanks a lot!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It seems that the installer need to find head files of some dependencies in /usr/local/include/, but the head files of dependencies installed by arm brew is in /opt/homebrew/include and the installer can't find them.

One solution is reinstalling brew under Rosetta 2, then installing related dependencies (pkg-config cairo, libpng, jpeg, giflib, pango).

Another solution is creating symbolic link in /usr/local/include/ linking to related head files in /opt/homebrew/include (For example, sudo ln -s /opt/homebrew/include/jpeglib.h /usr/local/include/jpeglib.h) (I don't think it's an elegant solution but at least it works).

(I also install xcode but I'm not sure whether it has something to do with this problem.)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...