fkling / astexplorer

A web tool to explore the ASTs generated by various parsers.
https://astexplorer.net/
MIT License
6.04k stars 711 forks source link

[PROJECT BUG] When executing `npm install` in the `website` directory, an error is thrown #710

Closed ericmorand closed 5 months ago

ericmorand commented 5 months ago

Describe the bug

When executing npm install in the website directory - as explained by the documentation - the following error is thrown by npm:

$ npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: astexplorer@2.0.0
npm ERR! Found: eslint@6.8.0
npm ERR! node_modules/eslint
npm ERR!   dev eslint@"^6.6.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@"^7.0.0 || ^8.0.0" from @angular-eslint/template-parser@14.4.0
npm ERR! node_modules/@angular-eslint/template-parser
npm ERR!   @angular-eslint/template-parser@"^14.0.2" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /home/[REDACTED]/.npm/_logs/2024-01-24T14_46_36_374Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /home/[REDACTED]/.npm/_logs/2024-01-24T14_46_36_374Z-debug-0.log

This happens with npm 10 - I didn't test with previous versions but considering the error it is likely to happen with every version of npm above 6.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'webiste'
  2. Run npm install

Expected behavior

Project dependencies are successfully installed.

Scipion commented 5 months ago

The node version to build the project as you can check in https://github.com/fkling/astexplorer/blob/master/.tool-versions is LTS Gallium (which is node v16) and comes with npm 8.x.

When you change your node version with n or nvm you can build the project properly.

but btw you should run yarn, not npm

ericmorand commented 5 months ago

Can I propose that this is explained in the README?

Right now, following the documentation is not enough to work on the project:

Build your own version for development Clone the repository. Go to website/. Install all dependencies with yarn install (you can run npm install as well). Run yarn run build for the final minimized version. Run yarn run watch for incremental builds. Run yarn start to start a simple static webserver.

Also, the documentation is very clear about the fact that yarn is not mandatory:

(you can run npm install as well)

fkling commented 5 months ago

I've updated the README to mention node v16 and to remove mentions of npm. It may still work but I only used yarn in the last years so I can't make guarantees.