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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Error: ENOENT: no such file or directory, open" when trying parcel serve --log-level 5 #2392

Closed
rosensama opened this issue Dec 11, 2018 · 6 comments

Comments

@rosensama
Copy link

rosensama commented Dec 11, 2018

馃悰 bug report

When I try to enable log level 5 on the parcel dev server parcel serve I get an error.

Error: ENOENT: no such file or directory, open '/Users/rosensama/projects/newproject/parcel-debug-12/10/2018@11:32:21 PM.log'

馃帥 Configuration (.babelrc, package.json, cli command)

No .bablerc used. This is an Elm project (thanks for the built-in plugin!) so package.json is minimal.

    "dependencies": {},
    "scripts": {
        "build": "parcel build src/index.html",
        "serve": "parcel serve src/index.html --https --cert server/ssl.cert --key server/ssl.key --log-level 5"
    },
    "devDependencies": {
        "node-elm-compiler": "^5.0.1",
        "semantic-ui": "^2.4.2"
    }

The command is parcel serve src/index.html --https --cert server/ssl.cert --key server/ssl.key --log-level 5

馃 Expected Behavior

It should create a log file and operate as normal.

馃槸 Current Behavior

11:32:21 PM]: Server running at https://localhost:1234 
[11:32:21 PM]: Building...
events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, open '/Users/rosensama/projects/newproject/parcel-debug-12/10/2018@11:32:21 PM.log'
Emitted 'error' event at:
    at fs.open (internal/fs/streams.js:293:12)
    at FSReqCallback.oncomplete (fs.js:148:20)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! newproject@0.0.0 serve: `parcel serve src/index.html --https --cert server/ssl.cert --key server/ssl.key --log-level 5`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the newproject@0.0.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/rosensama/.npm/_logs/2018-12-11T05_32_21_786Z-debug.log

馃拋 Possible Solution

Check if directories exist and create them if needed? If I manually create parcel-debug-12/ and parcel-debug-12/10/ in ~/projects/newproject, it works.

The failed path in is my home directory and parcel is being run as me, combine that with how creating the directories helps and I'm 99% this is not a permissions problem.

It's a tangent, but I suggest removing the spaces and special characters that require escaping at a shell prompt from the file name. Look at the log file name in .npm/_logs, for example.

馃敠 Context

I'm troubleshooting my application and wanted to see if the most verbose level included any helpful information, so was trying the highest log level.

馃實 Your Environment

Software Version(s)
Parcel 1.10.3
Node 11.2.0
npm/Yarn npm 6.4.1
Operating System OSX mojave
@DeMoorJasper
Copy link
Member

DeMoorJasper commented Dec 11, 2018

Not sure why this happens as cwd should normally exist?

Related code: https://github.com/parcel-bundler/parcel/blob/master/packages/core/logger/src/Logger.js#L75-L80

@rosensama
Copy link
Author

rosensama commented Dec 12, 2018

I don't think the missing directories would normally exist, but I don't know how cwd() resolved them.

In my example /Users/rosensama/projects/newproject/ is where package.json is found. I needed to create two directories that I wouldn't expect to normally exist as they involve the month and date and are parcel specific.

/Users/rosensama/projects/newproject/
    parcel-debug-12/  
        10/                                 <-- worked once created

Dumping the output of cwd() and the log file path, it seems to be a mismatch between the logfile path and the path createWriteStream is pointed to. I dumped both after line 75 and:

cwd: /Users/rosensama/projects/mendoza
this.logFile.path: '/Users/rosensama/projects/mendoza/parcel-debug-12/11/2018@8:21:26 PM.log'

Maybe just pass this.logFile.path to createWriteStream or set this.logFile.path to join(cwd, filename).

My tangential request was a dupe of #2288 (already merged).

@DeMoorJasper
Copy link
Member

@rosensama ow now I see. The log file uses toisostring, which can include a / which makes it a directory instead of part of the filename. Probably best if we replace / and\ with a -

Sent with GitHawk

@rosensama
Copy link
Author

To be clear toISOString is not used in the version I'm running (the current release, I think) but I do see that #2288 moved to that to make for friendlier names. My version is using toLocaleTimeString.

I'm pretty sure ISO time strings do not include slashes (unless you are doing intervals).

@DeMoorJasper
Copy link
Member

@rosensama you're right I mixed those up. Than this issue should probably be closed as it's already fixed.

@LukBukkit
Copy link

LukBukkit commented Mar 26, 2019

I'm getting close to the same error:

$ D:\lukas\Coding\PhpstormProjects\ParcelProject\node_modules\.bin\parcel
index.html --log-level 5
[19:03:44]: Server running at http://localhost:1234
[19:03:44]: Building...
events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, open 'D:\lukas\Coding\PhpstormProjects
\ParcelProject\parcel-debug-2019-03-26T18:03:44.972Z.log'
Emitted 'error' event at:
    at lazyFs.open (internal/fs/streams.js:272:12)
    at FSReqWrap.args [as oncomplete] (fs.js:140:20)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this comm
and.

I'm using Parcel 1.12.3 and Node v10.15.3

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

No branches or pull requests

3 participants