comp426-2022-fall / a02

Create a command line Node.js package that ingests API data from Open-Meteo
GNU Affero General Public License v3.0
0 stars 0 forks source link

Unable to run cli.js as galosh.js, "No such file or directory" #10

Closed calebbg closed 2 years ago

calebbg commented 2 years ago

What is happening?

"node cli.js" is working as intended, but trying to run the program with "galosh.js" is not working. I have inserted the bin and type:module statements in package.json, and I have run "npm link".

What does the error say is happening?

The error says there is no file or directory called galosh.js in the node environment.

What do you think the error means?

I'm honestly not sure why this would not be working, as I followed the steps listed in the a02 readme. It seems like something is not linking properly.

Command string

galosh.js -s 35.014 -w 79.4545 -z America/New_York -d 3 galosh.js -h galosh.js

Code snippet

json package code

Screenshots

galosh not found

Error log

/usr/bin/env: ‘node\r’: No such file or directory

Node.js version

v16.17.0

Operating system

Linux UNC-R90YDFXE 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

calebbg commented 2 years ago

An interesting wrinkle to this, it appears to be working in the autograder, just not locally on my machine. That is assuming I understand the autograder tests correctly. I would still be interested to hear any theories as to why this might be.

kaival1524 commented 2 years ago

I have the same error occurring but it is happening on a03.

vennila-t commented 2 years ago

Hello Caleb,

Apologies for the delay in response for this issue. I would recommend looking closely at your package.json file. The "name" should point to "galosh.js" and not simply "galosh". This may by the cause for the error, as galosh.js may not be found since it hasn't been written formally in your json file. Also, make sure your "main" points to "cli.js" and not "index.js" as there should be no index.js file for this assignment.

Let me know whether this clears up your issues.

vennila-t commented 2 years ago

Kaival (and Caleb if the above doesn't fix your issue),

For your issue, it seems that the file node_modules has CRLF (Windows) line endings instead of LF (Linux) (\r instead of \n). You can fix this locally by finding the file locally and changing the line endings using an editor like VSCode or dos2unix.

Here is how to do it via dos2unix but it may be easier to do it manually in VSCode