Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build this project on my own mac #79

Open
Mirocos opened this issue Jul 20, 2020 · 10 comments
Open

Build this project on my own mac #79

Mirocos opened this issue Jul 20, 2020 · 10 comments

Comments

@Mirocos
Copy link

Mirocos commented Jul 20, 2020

I want build this web project to my own mac, so I can read some source code and try to edit it.
But I always failed when I use npm install to download those necessary module.
The point that causes failures seems to be install module from github...(I try to use proxy, but it doesn't work)

Is there any way that I could build it successfully?

@greggman
Copy link
Member

installing modules from github is normal. What errors are you getting?

@Mirocos
Copy link
Author

Mirocos commented Jul 20, 2020

installing modules from github is normal. What errors are you getting?
I am always stuck in this module.
image
It seems that install just stop at this module.

@greggman
Copy link
Member

You could try deleting package-lock.json and editing package.json these 2 lines

"@gfxfundamentals/lesson-builder": "git://github.com/gfxfundamentals/lesson-builder.git#v1.4.1",
"@gfxfundamentals/live-editor": "git://github.com/gfxfundamentals/live-editor.git#v1.0.8",

Change to this

"@gfxfundamentals/lesson-builder": "https://github.com/gfxfundamentals/lesson-builder.git#v1.4.1",
"@gfxfundamentals/live-editor": "https://github.com/gfxfundamentals/live-editor.git#v1.0.8",

or this

"@gfxfundamentals/lesson-builder": "git+https://github.com/gfxfundamentals/lesson-builder.git#v1.4.1",
"@gfxfundamentals/live-editor": "git+https://github.com/gfxfundamentals/live-editor.git#v1.0.8",

and see if that fixes anything. I doubt since it's working for others. In fact you cloned the main repo from github and you're here commenting on github so it should be no different.

@Mirocos
Copy link
Author

Mirocos commented Jul 20, 2020

You could try deleting package-lock.json and editing package.json these 2 lines

"@gfxfundamentals/lesson-builder": "git://github.com/gfxfundamentals/lesson-builder.git#v1.4.1",
"@gfxfundamentals/live-editor": "git://github.com/gfxfundamentals/live-editor.git#v1.0.8",

Change to this

"@gfxfundamentals/lesson-builder": "https://github.com/gfxfundamentals/lesson-builder.git#v1.4.1",
"@gfxfundamentals/live-editor": "https://github.com/gfxfundamentals/live-editor.git#v1.0.8",

or this

"@gfxfundamentals/lesson-builder": "git+https://github.com/gfxfundamentals/lesson-builder.git#v1.4.1",
"@gfxfundamentals/live-editor": "git+https://github.com/gfxfundamentals/live-editor.git#v1.0.8",

and see if that fixes anything. I doubt since it's working for others. In fact you cloned the main repo from github and you're here commenting on github so it should be no different.

I am sorry I have tried these two ways. And now it still fail like this(while i use sudo npm install)
image

Or stuck at this like(use npm install without sudo...),sometime when I reinstall and it may not be this module in the picture but others.

image

@greggman
Copy link
Member

You should almost never use sudo with npm

this repo certainly doesn't need sudo.

I am not an npm expert. If it was me I'd probably delete /Users/mirocros/.npm or rename it and start over. Maybe install node again. Sorry I don't have any answers.

On mac I use nvm to install node. No sudo needed.

@Mirocos
Copy link
Author

Mirocos commented Jul 20, 2020 via email

@greggman
Copy link
Member

I'm sorry you're running into problems. I don't know how to help. It's should be as simple as

git clone https://github.com/gfxfundamentals/webgl2-fundamentals.git
cd webgl2-fundamentals
npm install
npm run build
npm start

And AFAICT it is that simple for most people. I build on 2 macs, a windows PC, and a linux machine.

On Mac I used nvm to install node. I added the required lines to my .bash_profile and my .zshrc files

ATM I'm using node 12.18.0

nvm install 12.18.0

@greggman
Copy link
Member

Note: you can download the built site here

@greggman
Copy link
Member

greggman commented Jul 22, 2020

Oh, one more thing, building doesn't do anything except build the articles from .md files into .html files and generate the table of contents. All the examples and diagrams just run without building. That includes the state diagram. If you just clone the repo and serve the base folder

git clone https://github.com/gfxfundamentals/webgl2-fundamentals.git
servez webgl2-fundamentals

You can the state diagram at http://localhost:8080/webgl/lessons/resources/webgl-state-diagram.html

I used servez above but you can use any web server

@aabbtree77
Copy link

As suggested, "Permission denied" is due to the system installs, system node.js interfering most likely. Install nvm (via https://github.com/nvm-sh/nvm, "Git Install" section works for me, but I am on Ubuntu 20.04). See also "Troubleshooting on macOS" there in case you don't pass this stage as this might help you to find out if something is busted around Xcode, git and shell, if you cannot pass this stage, nuke your mac from orbit). Check that git clones by default into your home related folders, not into the system, install nvm without any sudo, and then install node via "nvm install node", this will deactivate the system node.

To deal with frequently occurring npm deprecation warnings or even errors, this is often useful for me:
https://stackoverflow.com/questions/42308879/how-to-solve-npm-error-npm-err-code-elifecycle
That is, inside the problematic folder run this:

npm cache clean --force
rm -rf node_modules package-lock.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants