mattdesl / canvas-sketch

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

Cannot install canvas-sketch #134

Closed te-lei closed 2 years ago

te-lei commented 2 years ago
root@Leiths-MacBook-Pro ~ # canvas-sketch                                      
zsh: command not found: canvas-sketch

Have been troubleshooting many different options such as using sudo and root but still no luck. When I try to change the npm's directory I get the following:

root@Leiths-MacBook-Pro ~ # npm config set prefix '~/.npm-global'
npm ERR! code EPERM
npm ERR! syscall scandir
npm ERR! path /Users/leith/.Trash
npm ERR! errno -1
npm ERR! Error: EPERM: operation not permitted, scandir '/Users/leith/.Trash'
npm ERR!  [Error: EPERM: operation not permitted, scandir '/Users/leith/.Trash'] {
npm ERR!   errno: -1,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'scandir',
npm ERR!   path: '/Users/leith/.Trash'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/leith/.npm/_logs/2021-12-22T03_14_49_555Z-debug-0.log
root@Leiths-MacBook-Pro ~ # 

Also, not sure why I don't have a bash, but only zsh and this is the directory in my /user:

root@Leiths-MacBook-Pro /Users # ls
.localized      Guest           Shared          leith
root@Leiths-MacBook-Pro /Users # cd leith
root@Leiths-MacBook-Pro ~ # ls
.CFUserTextEncoding
.DS_Store
.Trash
.anaconda
.atom
.cache
.conda
.condarc
.config
.continuum
.ipynb_checkpoints
.ipython
.jupyter
.matplotlib
.npm
.npm-global
.npmrc
.swiftpm
.tcshrc
.xonshrc
.zprofile
.zsh_history
.zsh_sessions
.zshrc
Applications
Creative Cloud Files
DAML 1
Desktop
Documents
Downloads
Library
Movies
Music
Pictures
Public
PycharmProjects
Terminal_Backup_Files
Untitled.ipynb
index.html
my-sketches
node_modules
opt
package-lock.json
package.json
rev.jpg
sketches
root@Leiths-MacBook-Pro ~ # 

The path is this:

root@Leiths-MacBook-Pro ~ # echo $PATH
/Users/leith/opt/anaconda3/condabin:/Users/leith/opt/anaconda3/condabin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
root@Leiths-MacBook-Pro ~ # 
mattdesl commented 2 years ago

Hey @te-lei, some of those errors makes me think that npm or node have not been installed correctly, if you are not even able to set npm config without generating an error. If you haven't tried it, I would recommend re-downloading and re-installing the latest version from Nodejs site, which comes with npm.

The zsh: command not found: canvas-sketch appears to be something to do with the PATH to npm global directory not being recognized by your terminal.

For now, I'd recommend maybe trying the local installation steps outlined here:

https://github.com/mattdesl/canvas-sketch/issues/125#issuecomment-1003946650

If you do happen to set up your permissions + config correctly and are able to install globally, also make sure you have your PATH including the folder you've set it to. I have a file ~/.bash_profile and ensure the following line is present in it, so that it loads that path into the env var each time my terminal is run. But this file may be different depending on your shell (like ~/.zshrc).

export PATH=~/.npm-global/bin:$PATH
AnnaMilena commented 2 years ago
Screenshot 2022-02-23 at 21 20 41

I have similar issue zsh: command not found: canvas-sketch despite the fact that I went to my folder in order to create a new file so the question is whether is a chance to fix this or there is only one option re-installing?

te-lei commented 2 years ago

Hey @AnnaMilena I still am yet to get a solution. Are you also running on Monterey?

AnnaMilena commented 2 years ago

hey , Yes I do.

te-lei commented 2 years ago

@AnnaMilena Yeah I think that's what made our terminal shell default to zsh instead of bash and mess something up. I'll let you know if it works but even after reinstalling I can't figure it out. Did you try the same?

AnnaMilena commented 2 years ago

I gonna re-install again and see what happens . I configured and fixed from the root Aministrator npm global used by profile. I used these commands, but it doesnt work in my case . plus I am a novice , I know general Linux commands . I had this issue but I read somewhere that this is not a serious issue and code should work..

Screenshot 2022-02-22 at 20 10 34
fturcheti commented 2 years ago

@AnnaMilena @te-lei Have you tried to install canvas-sketch locally? You'd install it in your project directory with npm install canvas-sketch-cli --save-dev and you'd have to run canvas-sketch with npx (npx canvas-sketch my-sketch.js --open, for example).

AnnaMilena commented 2 years ago

Thanks, defenitely I will try it. I hope it will work!

mattdesl commented 2 years ago

Closing this, see this comment for further details: https://github.com/mattdesl/canvas-sketch/issues/96#issuecomment-1231548822