2

I can't succeed with npm install packages after $npm install, it shows this output:

> [email protected] install /home/samuel/testes/Avanade Angular Academy by Gama/gama-avanade-tryout01/node_modules/canvas
> node-gyp rebuild

./util/has_lib.sh: 31: ./util/has_lib.sh: pkg-config: not found
gyp: Call to './util/has_lib.sh freetype' returned exit status 0 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/samuel/.npm-global/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:219:12)
gyp ERR! System Linux 4.9.0-4-amd64
gyp ERR! command "/usr/bin/node" "/home/samuel/.npm-global/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/samuel/testes/Avanade Angular Academy by Gama/gama-avanade-tryout01/node_modules/canvas
gyp ERR! node -v v6.12.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/samuel/.npm/_logs/2017-12-12T02_40_55_700Z-debug.log

What should I do? Thanks for all of you help!

1
  • 1
    "A complete log of this run can be found in: /home/samuel/.npm/_logs/2017-12-12T02_40_55_700Z-debug.log"... Commented Dec 12, 2017 at 2:50

2 Answers 2

3

The solution is to install some external dependencies. The commands below were enough.

$ sudo apt-get update 
$ sudo apt-get install libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev build-essential g++

After this, $npm install works!

Sign up to request clarification or add additional context in comments.

4 Comments

Hello , where to install these command ? i am getting 'sudo' is not recognized as an internal or external command,operable program or batch file.
@Anuj, you are probably logged in as root user, you don't need to write sudo.
perfect i was waiting for this asnwer from past 2020
fwiw this did not work for me
0

delete node modules and package-lock.json

1.yarn install or npm install 2.npm start

1 Comment

where does it say that OP uses yarn? Please add more example code on why your answer works better than the already approved one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.