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

Unable to Run Node.js Website Locally on Windows 11 with Node.js 18.18.0 and npm 9.8.1 #5921

Closed
shaikahmadnawaz opened this issue Sep 30, 2023 · 43 comments
Labels

Comments

@shaikahmadnawaz
Copy link
Contributor

shaikahmadnawaz commented Sep 30, 2023

URL:

https://github.com/nodejs/nodejs.org

Browser Name:

Brave

Browser Version:

v1.58.135

Operating System:

Windows 11, 22H2, 22621.2283

How to reproduce the issue:

Problem: I am encountering difficulties when trying to run the Node.js Website locally on my Windows 11 machine using Node.js version 18.18.0 and npm version 9.8.1. The local development environment is not working as expected.

Steps to Reproduce:

  1. Clone the Node.js Website repository.
  2. Run npm ci to install project dependencies.
  3. Attempt to start the local preview with npx turbo serve.

Expected Behavior: The local development environment should start without errors, allowing me to preview my changes.

Actual Behavior:

npm ci

Screenshot (1286)

npx turbo serve

Screenshot (1287)

Environment:

  • Operating System: Windows 11
  • Node.js Version: 18.18.0
  • npm Version: 9.8.1
@AugustinMauroy

This comment was marked as off-topic.

@shaikahmadnawaz
Copy link
Contributor Author

have you try to use npm I ? it's can change something 🤔

I tried that too.

@shaikahmadnawaz
Copy link
Contributor Author

have you try to use npm I ? it's can change something 🤔

Screenshot (1290)

Check this once @AugustinMauroy

@AugustinMauroy

This comment was marked as off-topic.

@shaikahmadnawaz
Copy link
Contributor Author

could you try to remove node_modules and after npm i ?

Screenshot (1291)

Still facing the same error 🥲, please help.

@AugustinMauroy
Copy link
Contributor

apart from the error message during installation, what happens when you run the project ?

@shaikahmadnawaz
Copy link
Contributor Author

apart from the error message during installation, what happens when you run the project ?

Screenshot (1292)
Screenshot (1293)

@AugustinMauroy

This comment was marked as off-topic.

@shaikahmadnawaz
Copy link
Contributor Author

what is the change do in your branch ?

Screenshot (1295)
Screenshot (1296)
Screenshot (1297)
Screenshot (1298)

These are automatically generated when I try to install and run it.

@AugustinMauroy

This comment was marked as off-topic.

@ovflowd
Copy link
Member

ovflowd commented Sep 30, 2023

what is the change do in your branch ?

Screenshot (1295) Screenshot (1296) Screenshot (1297) Screenshot (1298)

These are automatically generated when I try to install and run it.

The changes on package-lock should not be done. The files on public are generated automatically and that's fine. The changes on the VS Code settings are due to you probably altering it. Either by accepting/rejecting a VS Code prompt.

@ovflowd
Copy link
Member

ovflowd commented Sep 30, 2023

have you try to use npm I ? it's can change something 🤔

Screenshot (1290)

Check this once @AugustinMauroy

This is fine. We manually disable Next.js telemtry.

@shaikahmadnawaz
Copy link
Contributor Author

Okay then, any solution for this? to stop the change in package-lock.json @ovflowd

@ovflowd
Copy link
Member

ovflowd commented Sep 30, 2023

It's important to mention that react is a peer dependency (https://github.com/nodejs/nodejs.org/blob/main/package.json) and since NPM v7 they are automatically installed.

Something is wrong on your Node.js setup. That's the only I thing I can think of. Do you use WSL or anything? How did you install Node.js?

@ovflowd
Copy link
Member

ovflowd commented Sep 30, 2023

I've made a fresh clone here, on my Windows machine. Everything is working fine.

image

@ovflowd
Copy link
Member

ovflowd commented Sep 30, 2023

My recommendation:

  • Reinstall Git, and use Git Bash if possible
  • Reinstall Node.js and check the mark of "install additional node.js dev tools" when using the Node.js installer. Download the latest LTS.
  • Delete the nodejs.org folder after all of this and reclone the repository
  • Disable/Remove VSCode Extensions. We recommend only using the ones recommended by the repository (.vscode/extensions.json)
    • Sometimes other extensions play and mess around with things

@ovflowd
Copy link
Member

ovflowd commented Sep 30, 2023

Also, regarding these two files, simply read the Collaborator Guidelines. These are autogenerated files, and they always generate automatically. It's fine keeping them and they never commit by themselves. We have a Git Hook that automatically ignores these files on commits.

image

@shaikahmadnawaz
Copy link
Contributor Author

It's important to mention that react is a peer dependency (https://github.com/nodejs/nodejs.org/blob/main/package.json) and since NPM v7 they are automatically installed.

Something is wrong on your Node.js setup. That's the only I thing I can think of. Do you use WSL or anything? How did you install Node.js?

I used NVM to install nodejs 18.18.0

@shaikahmadnawaz
Copy link
Contributor Author

My recommendation:

  • Reinstall Git, and use Git Bash if possible

  • Reinstall Node.js and check the mark of "install additional node.js dev tools" when using the Node.js installer. Download the latest LTS.

  • Delete the nodejs.org folder after all of this and reclone the repository

  • Disable/Remove VSCode Extensions. We recommend only using the ones recommended by the repository (.vscode/extensions.json)

    • Sometimes other extensions play and mess around with things

Sure, I will do all these steps.

@shaikahmadnawaz
Copy link
Contributor Author

Also, regarding these two files, simply read the Collaborator Guidelines. These are autogenerated files, and they always generate automatically. It's fine keeping them and they never commit by themselves. We have a Git Hook that automatically ignores these files on commits.

image

Okay

@shaikahmadnawaz
Copy link
Contributor Author

I've made a fresh clone here, on my Windows machine. Everything is working fine.

image

Thank you so much for making these many efforts for me @ovflowd

@ovflowd
Copy link
Member

ovflowd commented Sep 30, 2023

No worries. Hopefully you figure out what's wrong

@shaikahmadnawaz
Copy link
Contributor Author

No worries. Hopefully you figure out what's wrong

Yes, working on the steps you mentioned, will update you if I figure it out. 👍

@shaikahmadnawaz
Copy link
Contributor Author

It's not working 🥲 @ovflowd

@shaikahmadnawaz
Copy link
Contributor Author

It's okay leave, I am using GitHub codespace to run it locally, see @ovflowd this is how it looks ✨

Screenshot (1299)
Screenshot (1300)

@ovflowd
Copy link
Member

ovflowd commented Sep 30, 2023

Do you have Git Bash installed?

Can you run ls -la within node_modules with Git Bash?

How are you installing packages?

Are you still using NVM? Have you installed node with Node MSI installer and added the additional tools?

@ovflowd
Copy link
Member

ovflowd commented Sep 30, 2023

It's okay leave, I am using GitHub codespace to run it locally, see @ovflowd this is how it looks ✨

Screenshot (1299)

Screenshot (1300)

Codespaces saves the day, but Id still love to get to the bottom of it 😅

As Im genuinely curious what could be causing this 🫠

@shaikahmadnawaz
Copy link
Contributor Author

Do you have Git Bash installed?

Can you run ls -la within node_modules with Git Bash?

How are you installing packages?

Are you still using NVM? Have you installed node with Node MSI installer and added the additional tools?

git did, Yes, I installed node with Node MSI installer and added the additional tools, yes I can run ls -la within node_modules with Git Bash, I am Installing packages using git bash and the command is npm ci

@ovflowd
Copy link
Member

ovflowd commented Sep 30, 2023

Do you have Git Bash installed?

Can you run ls -la within node_modules with Git Bash?

How are you installing packages?

Are you still using NVM? Have you installed node with Node MSI installer and added the additional tools?

git did, Yes, I installed node with Node MSI installer and added the additional tools, yes I can run ls -la within node_modules with Git Bash, I am Installing packages using git bash and the command is npm ci

Gotcha, what I meant to ask is if with ls -la you see the react folder inside node_modules

I want to understand if somehow npm decided to not install the peerDependency

@shaikahmadnawaz

This comment has been minimized.

@ovflowd
Copy link
Member

ovflowd commented Sep 30, 2023

I mean can you run

cd node_modules && ls -la

Also last question, do you have a .npmrc on your machine?

cat ~/.npmrc

@shaikahmadnawaz
Copy link
Contributor Author

I mean can you run

cd node_modules && ls -la

Also last question, do you have a .npmrc on your machine?

cat ~/.npmrc

image

@shaikahmadnawaz
Copy link
Contributor Author

cat ~/.npmrc

$ cat ~/.npmrc
legacy-peer-deps=true

@ovflowd
Copy link
Member

ovflowd commented Sep 30, 2023

cat ~/.npmrc

$ cat ~/.npmrc
legacy-peer-deps=true

We found the issue. can you delete that file? And then delete node_modules of your repository and run npm i again. That should do the trick...

@shaikahmadnawaz
Copy link
Contributor Author

cat ~/.npmrc

$ cat ~/.npmrc
legacy-peer-deps=true

We found the issue. can you delete that file? And then delete node_modules of your repository and run npm i again. That should do the trick...

Yes, doing

@shaikahmadnawaz
Copy link
Contributor Author

image

@ovflowd
Copy link
Member

ovflowd commented Sep 30, 2023

Yeah seems alright now, feel free to try npx turbo serve

@shaikahmadnawaz
Copy link
Contributor Author

image
image

Here we go, now it's working absolutely fine ✨

@ovflowd
Copy link
Member

ovflowd commented Sep 30, 2023

Glad to hear issue was solved ;)

@ovflowd ovflowd closed this as completed Sep 30, 2023
@shaikahmadnawaz
Copy link
Contributor Author

Thank you so much for guiding me, and hats off to your patience @ovflowd 👏

@ovflowd
Copy link
Member

ovflowd commented Sep 30, 2023

Thank you so much for guiding me, and hats off to your patience @ovflowd 👏

Of course :) Here to help!

@shaikahmadnawaz
Copy link
Contributor Author

One final query, what does .npmrc file do or why it is added or removed? @ovflowd

@ovflowd
Copy link
Member

ovflowd commented Sep 30, 2023

One final query, what does .npmrc file do or why it is added or removed? @ovflowd

.npmrc is a NPM configuration file that allows you to override default NPM settings. The issue that comes from that specific issue, is that since NPM v7, peerDependencies (which react is one) are installed automatically alongside regular dependencies.

With the legacy-peer-deps they won't. Hence why react did not get installed.

More details: npm/cli#4934

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

No branches or pull requests

3 participants