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

"No such file or directory" error if pptip run outside of the the package root #1

Open
mshenfield opened this issue Jan 4, 2016 · 0 comments · May be fixed by #2
Open

"No such file or directory" error if pptip run outside of the the package root #1

mshenfield opened this issue Jan 4, 2016 · 0 comments · May be fixed by #2

Comments

@mshenfield
Copy link

If pptip is run outside of the project root, an error is thrown. It looks like it is resolving ./pragmaticprogrammer.txt to the current working directory. I think using __dirname might fix it - testing locally. Expect a PR!

node: 4.2.1
pp-daily-tip: 1.0.0

Error:

fs.js:549
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open './pragmaticprogrammer.txt'
    at Error (native)
    at Object.fs.openSync (fs.js:549:18)
    at Object.fs.readFileSync (fs.js:397:15)
    at Object.<anonymous> (/path/to/gitcheckout/of/daily-pragmatic-tip/index.js:5:15)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:467:10)
    at startup (node.js:134:18)
@mshenfield mshenfield changed the title "No suche file or directory" error if pptip run outside of the the package root "No such file or directory" error if pptip run outside of the the package root Jan 4, 2016
mshenfield added a commit to mshenfield/daily-pragmatic-tip that referenced this issue Jan 4, 2016
This should fix sfrapoport#1. Uses the [__dirname](https://nodejs.org/docs/latest/api/globals.html#globals_dirname) of the package to read local data files.

Use `path.join` to combine the two, this gives some free cross-platform support :)
@mshenfield mshenfield linked a pull request Jan 4, 2016 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant