mattdesl / canvas-sketch

[beta] A framework for making generative artwork in JavaScript and the browser.
MIT License
5.01k stars 393 forks source link

canvas-sketch command not found #140

Closed uxwellbeing closed 2 years ago

uxwellbeing commented 2 years ago

Hi, I tried to install with npm install canvas-sketch-cli -g for many times because canvas-sketch -v shows:

zsh: command not found: canvas-sketch

I tried to search on stackoverflow and npm pages, but there is no similar case. I also installed npm for many times with npm install -g npm

This is what I got:

 flyingship@gyoenhisens-MacBook-Pro sketches % npm install -g npm

 changed 14 packages, and audited 215 packages in 967ms

 11 packages are looking for funding
   run `npm fund` for details

3 moderate severity vulnerabilities

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

So far, I still got these error messages with npm install canvas-sketch-cli -g. You can see the result as below: Any recommendation before I jump into the sudo solution? Thank you!

flyingship@gyoenhisens-MacBook-Pro sketches % node -v
v16.13.2

flyingship@gyoenhisens-MacBook-Pro sketches % npm -v
8.1.2

flyingship@gyoenhisens-MacBook-Pro sketches % npm install canvas-sketch-cli -g

npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated core-js@2.6.12: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.

changed 648 packages, and audited 649 packages in 16s

48 packages are looking for funding
  run `npm fund` for details

8 vulnerabilities (3 moderate, 5 high)

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details. 

I also tried to update npm with npm update -g, but got similar results:

flyingship@gyoenhisens-MacBook-Pro sketches % npm update -g
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated core-js@2.6.12: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.

changed 662 packages, and audited 863 packages in 15s

57 packages are looking for funding
  run `npm fund` for details

9 vulnerabilities (4 moderate, 5 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
fturcheti commented 2 years ago

The output of your canvas-sketch installation is fine—those warning are not errors. You must have a problem with your npm installation.

Can you try to run this command npm config set prefix /usr/local?

I've suggested this fix to another user here and it solved its issue. The explanation for the fix is here.

uxwellbeing commented 2 years ago

@fturcheti Thank you. This does work!

mattgr0619 commented 2 years ago

Following this thread since I have the same issues. After verifying npm cofig is set to /usr/local, I am still getting canvas-sketch is not recognized after running command to create new file canvas-sketch sketch-01.js --new . Any ideas what's going wrong? Npm is v8.5.5 and node is v16.15.0