-
Notifications
You must be signed in to change notification settings - Fork 687
Blendid Run Error #532
Comments
Looks like it is something to do with the path to the package in blendid/gulpfile.js/lib/task-defaults.js Swapping out var pkg process.env.PWD with a relative path means that blendid can find the package but other references break later down the chain. |
The problem is indeed coming from So, the problem is multi-fold. I did two kind of tests with one variance for each kind. First, I tested with the bin fix I did and without. For each kind, I also tested running On Mac OS X, the On Windows, it seems the On Windows + MSYS2, the terminal is POSIX aware and convert from <-> to Windows path if the executed binary if Windows only. The problem that arise is that The ultimate fix is coming from a special environment variable that is set by Gulp. Indeed, they have the
I will open a PR with the updated code in ResultsMac OS X (without bin fix)Terminal at
|
I did test the fix on the three systems mentioned above. I'm pretty confident it should continue to work after the changes. @kferran Can you describe a bit your system. You seem to be using special terminal as I see in your screenshot that there is a diff --git a/gulpfile.js/lib/task-defaults.js b/gulpfile.js/lib/task-defaults.js
index 2bc608b..8c930b1 100644
--- a/gulpfile.js/lib/task-defaults.js
+++ b/gulpfile.js/lib/task-defaults.js
@@ -1,6 +1,6 @@
const os = require('os')
const path = require('path')
-const pkg = require(path.resolve(process.env.PWD, 'package.json'))
+const pkg = require(path.resolve(process.env.INIT_CWD, 'package.json'))
module.exports = {
javascripts: { |
@benjtinsley As for the init problem you solved, it seems the #471 was also the culprit. In the tests results above, if you look at the
Since the I never thought changing adding For the bug fix you did, we can either left it as-is or I can patch diff --git a/bin/blendid.js b/bin/blendid.js
index bd5641a..eff4853 100755
--- a/bin/blendid.js
+++ b/bin/blendid.js
@@ -2,7 +2,7 @@
const path = require('path');
const additionalArgs = require('minimist')(process.argv.slice(2))._
-const blendidEntryFile = require.resolve('blendid');
+const blendidEntryFile = path.dirname(require.resolve('blendid'));
const gulpModulePath = path.dirname(require.resolve('gulp'));
const gulpBinaryFile = path.join(gulpModulePath, '/bin/gulp'); Tell me if you think we should do that (path I really did not oversee all those problems. Sorry for the trouble. |
@kferran Note that I just noticed there is 66 other places where |
@maoueh thanks for you exhaustive research on this issue. i was also noticing some strange behavior when trying to if you haven't already i can change back the relative path commits in the init files and merge those in with your bin changes and pray that this does the trick! |
For the I will introduce a The I will try to complete the PR today but that may need to complete it this weekend, there is lot of places where |
@maoueh i think |
@maoueh Sorry just getting back to my desk. I am running cmder as my terminal in Windows. I'll bring down your pull request and try it out. |
…s#532) It appears that `process.env.PWD` is not consistent across platform as well as across sub-directory invocations. Indeed, even if it is consistent on Mac OS X (and probably Unix at the same time but untested), there is inconsitencies problem on Windows when using a POSIX transformer platform like Cygwin or MSYS2. Indeed, in those cases, `PWD` is not the canonical Windows path but the original POSIX path of the terminal. Furthermore, invoking from a sub-directory also fiddles with the `PWD` adding subdirectory into it. To fix that, it seems that Gulp is providing an environment variable that points to the root directory of the project and which is constant across platforms. See gulpjs/gulp@2bf23ba for the actual INIT_CWD implementation. So, to fix the problem everywhere, added a function `resolveRelativeToProject` that does the correct resolving using `INIT_CWD` environment variable instead of the previously used `PWD`. To make stuff easier to use next time, a `projectPath` function was added that does the resolving of paths relative to the project root directory. All previous usages of `path.(resolve|join)(process.env.PWD, ...)` that were used throughout the website are now using `projectPath(...)` instead. Fixed bin script `blendid/gulpfile.js/index.js` resolution to use `__dirname` instead of `require.resolve`. The `require.resolve` does not work when using `yarn link` to development `blendid` features. Indeed, `require.resolve` does the resolution from the linked project leading to `blendid` not being resolvable (because not present in the linked `node_modules` directory). By using `__dirname`, we achieve the same goal as before but being more robust to linked project for development.
Finally had a chance to bring down PR #533. Everything seems to be running fine with these fixes. Thanks for hammering this out guys! |
It appears that `process.env.PWD` is not consistent across platform as well as across sub-directory invocations. Indeed, even if it is consistent on Mac OS X (and probably Unix at the same time but untested), there is inconsitencies problem on Windows when using a POSIX transformer platform like Cygwin or MSYS2. Indeed, in those cases, `PWD` is not the canonical Windows path but the original POSIX path of the terminal. Furthermore, invoking from a sub-directory also fiddles with the `PWD` adding subdirectory into it. To fix that, it seems that Gulp is providing an environment variable that points to the root directory of the project and which is constant across platforms. See gulpjs/gulp@2bf23ba for the actual INIT_CWD implementation. So, to fix the problem everywhere, added a function `resolveRelativeToProject` that does the correct resolving using `INIT_CWD` environment variable instead of the previously used `PWD`. To make stuff easier to use next time, a `projectPath` function was added that does the resolving of paths relative to the project root directory. All previous usages of `path.(resolve|join)(process.env.PWD, ...)` that were used throughout the website are now using `projectPath(...)` instead. Fixed bin script `blendid/gulpfile.js/index.js` resolution to use `__dirname` instead of `require.resolve`. The `require.resolve` does not work when using `yarn link` to development `blendid` features. Indeed, `require.resolve` does the resolution from the linked project leading to `blendid` not being resolvable (because not present in the linked `node_modules` directory). By using `__dirname`, we achieve the same goal as before but being more robust to linked project for development.
Running into this issue when trying to run
yarn run blendid
after upgrading to version 4.4.2.http://prntscr.com/i2drtz
The text was updated successfully, but these errors were encountered: