Skip to content
This repository was archived by the owner on Apr 19, 2023. It is now read-only.

Conversation

@kimar
Copy link
Contributor

@kimar kimar commented Mar 1, 2016

Using Node.js v5.7 I'm receiving the following error when trying to run the app:

Using storage env:  development
module.js:341
    throw err;
    ^

Error: Cannot find module '/private/tmp/watchmen/webserver/routes../../../package.json'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.module.exports.getRoutes (/private/tmp/watchmen/webserver/routes/api-ping-plugins-route.js:8:17)
    at module.exports (/private/tmp/watchmen/webserver/app.js:42:35)
    at Object.<anonymous> (/private/tmp/watchmen/run-web-server.js:23:11)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)

It appears as if joining the path using + has a different outcome, I'd say it's better in any case to join it using the path-module.

@iloire
Copy link
Owner

iloire commented Mar 1, 2016

Hi Marcus, thanks for the PR!

It seems like the require internal implementation changed in node 5 and it is not accepting anymore the weird relative path that it was provided as a result of doing string concatenation between __dirnameand a relative path (that was pretty ugly actually)

Using path.join is indeed a much better option but I think path.resolve would be better suited for this scenario. What do you think?

iloire added a commit that referenced this pull request Mar 1, 2016
Use `path.join` for constructing path to `package.json`
@iloire iloire merged commit 900136b into iloire:master Mar 1, 2016
@iloire
Copy link
Owner

iloire commented Mar 1, 2016

I changed it here: 4510847
thanks again!

@kimar
Copy link
Contributor Author

kimar commented Mar 1, 2016

👍 path.resolve indeed sounds like what we want to use for this.

aVolpe added a commit to aVolpe/watchmen that referenced this pull request Aug 7, 2017
Add tags and filter by tag.

ref iloire#55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants