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

Fatal error When running npm test on fresh github clone #6038

Closed
1 of 17 tasks
shamun-khatri opened this issue Feb 28, 2023 · 18 comments · Fixed by #6124
Closed
1 of 17 tasks

Fatal error When running npm test on fresh github clone #6038

shamun-khatri opened this issue Feb 28, 2023 · 18 comments · Fixed by #6124

Comments

@shamun-khatri
Copy link

shamun-khatri commented Feb 28, 2023

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build Process
  • Unit Testing
  • Internalization
  • Friendly Errors
  • Other (specify if possible)

p5.js version

No response

Web browser and version

No response

Operating System

Windows

Steps to reproduce this

While setting up p5.js locally i am getting this error. whn i press command npm test after npm ci.

Snippet:

Running "eslint-samples:source" (eslint-samples) task
Fatal error: Cannot read properties of undefined (reading 'prefixLength')

@welcome
Copy link

welcome bot commented Feb 28, 2023

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms. Thank you!

@limzykenneth
Copy link
Member

Can we get the node.js and npm version you have?

@aditya-shrivastavv
Copy link
Contributor

I am facing the same problem.
node version - "18.12.1"

@limzykenneth
Copy link
Member

@aditya-shrivastavv Can you share the npm version as well? The OS version could be helpful too.

@aditya-shrivastavv
Copy link
Contributor

aditya-shrivastavv commented Mar 2, 2023

npm version = 9.3.1

OS version-
Windows 11
version = 22H2

Another problem I am having is with prettier, The problem is so annoying that I had to disable prettier. When I save the file so many changes happens.
for example -

function foo() {

}
// turns to 
function foo () {  // gap inserted

}

const obj = {
 prop1: value1,
 prop2: value2
}
// turns to
const obj = {
 prop1: value1,
 prop2: value2,  // comma automatically inserted
}

and so many changes like this
prettier latest version

@monmon2003
Copy link

@all-contributors please add @monmon2003 for code

@allcontributors
Copy link
Contributor

@monmon2003

I've put up a pull request to add @monmon2003! 🎉

@monmon2003
Copy link

Include this line of code inside rules in .eslintrc.json file : "linebreak-style": ["error", "windows"]
On including this, npm test works
2023-03-03

@limzykenneth
Copy link
Member

@aditya-shrivastavv I can't fully replicate, if you can find out a bit more why that's happening it would be great. We do not use prettier for the formatting of p5.js and I don't recommend the use of prettier here.

@monmon2003 I don't think that is relevant here and for p5.js we will enfore unix line endings instead of windows line endings. You should either set your text editor to use unix line endings, auto detect file line endings, or use the editorconfig plugin.

@aditya-shrivastavv
Copy link
Contributor

If we don't use prettier then why there is .prettierrc file in the codebase ? shouldn't we remove it ? due to it my prettier extension activates.

and here is my log on running npm test on a fresh github clone

image

@limzykenneth
Copy link
Member

We should remove the prettierrc file, I probably forgot last time, but the prettier dependency has already been removed from the project.

@aditya-shrivastavv
Copy link
Contributor

Yes @limzykenneth , that will be very helpful 😊

@monmon2003
Copy link

@limzykenneth Okay I will try using the editorconfig plugin.

@aditya-shrivastavv
Copy link
Contributor

Fatal error: Cannot read properties of undefined (reading 'prefixLength')
is still not resolved. I wonder is there a global dependency the project requires to run tests? 🤔

@limzykenneth
Copy link
Member

@aditya-shrivastavv There should be no global dependency required. If you have access to another machine, try building and testing on it, if it passes, we can start to compare the two.

@shamun-khatri
Copy link
Author

shamun-khatri commented Mar 25, 2023

Having one more question, Is this happening to all of the windows machines?

And also I found an old issue and their solution seem exactly like this. It's not working for me but it's not enough I think some of you guys should also try this.

#3692

@calebfoss
Copy link
Contributor

I'm also using Windows, ran into this same issue, and found @limzykenneth's comment on another issue about the EOL used in utils/sample-linter.js.

So I changed line 1:

import { EOL } from 'os';

To:

const EOL = '\n';

And that fixed it for me!

Would it make sense to change that in sample-linter.js for everyone?

@limzykenneth
Copy link
Member

@calebfoss I think it would make sense to do so, especially if that would solve this issue. Do go ahead with a PR if you like.

limzykenneth added a commit that referenced this issue May 3, 2023
Replace os import to always use '\n' for EOL - resolves #6038
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants