Comments (10)
@exogen -- Can you please create a reproduction for this and point me to it?
For reference, requirepack
is already using builder envs
(Just with straight string, not --envs-paths
at https://github.com/FormidableLabs/requirepack/blob/master/.travis.yml#L48-L69 And like your project, requirepack
is not using archetypes.
from builder.
@exogen -- Also when running envs
can you log out process.env.PATH
and paste it in this ticket? Thanks!
from builder.
@ryan-roemer: Sure thing – try cloning this repo: https://github.com/exogen/builder-test
git clone https://github.com/exogen/builder-test
cd builder-test
then:
npm install
npm run test
builder run test
builder envs test '[{ "FOO": 1 }]'
npm run
and builder run
work, the last one fails.
EDIT: Made it echo $PATH
now too. Here's what I get: /usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.
$PATH
from each:
npm run test:
/Users/brianbeck/.nvm/versions/node/v4.2.3/lib/node_modules/npm/bin/node-gyp-bin:/Users/brianbeck/Projects/Tests/builder-test/node_modules/.bin:/Users/brianbeck/.nvm/versions/node/v4.2.3/bin:./node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/brianbeck/bin
builder run test:
/Users/brianbeck/Projects/Tests/builder-test/node_modules/.bin:/Users/brianbeck/.nvm/versions/node/v4.2.3/bin:./node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/brianbeck/bin
builder envs test:
/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.
from builder.
Does not error and successfully runs for me:
$ builder envs test '[{ "FOO": 1 }]'
[builder:config:environment] {"cwd":"/Users/rroemer/scm/fmd/builder-test","dir":"/Users/rroemer/scm/fmd/builder-test/node_modules/builder/lib"}
[builder:config] Unable to load config file: .builderrc
[builder:builder-core:start:2158] Started: envs test
[builder:envs] Starting with queue size: unlimited
[builder:envs] Starting environment {"FOO":1} run for command: mocha
[builder:proc:start] mocha
0 passing (2ms)
[builder:proc:end:0] mocha
[builder:builder-core:end:2158] Ended normally: envs test
My PATH
logged out right before the exec is: /Users/rroemer/scm/fmd/builder-test/node_modules/.bin:/Users/rroemer/.nvm/v0.10.40/bin:/usr/local/heroku/bin:/Users/rroemer/.rvm/gems/ruby-2.0.0-p247/bin:/Users/rroemer/.rvm/gems/ruby-2.0.0-p247@global/bin:/Users/rroemer/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/rroemer/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Developer/Tools:/Users/rroemer/bin:/Users/rroemer/.gem/ruby/1.8/bin:./node_modules/.bin:/bin:/Users/rroemer/.rvm/bin
from builder.
@ryan-roemer: Hmm, maybe a Node/npm version?
$ node -v
v4.2.3
$ npm -v
3.5.2
from builder.
@ryan-roemer Works for me with Node v0.12.7 and same npm (3.5.2), so the difference is with Node 4.
from builder.
Confirmed error:
$ node -v; npm -v
v4.1.2
3.4.0
$ builder envs test '[{ "FOO": 1 }]'
[builder:config:environment] {"cwd":"/Users/rroemer/scm/fmd/builder-test","dir":"/Users/rroemer/scm/fmd/builder-test/node_modules/builder/lib"}
[builder:config] Unable to load config file: .builderrc
[builder:builder-core:start:2386] Started: envs test
[builder:envs] Starting with queue size: unlimited
[builder:envs] Starting environment {"FOO":1} run for command: mocha
[builder:proc:start] mocha
/bin/sh: mocha: command not found
[builder:proc:end:127] mocha
[builder:proc:error] Code: 127, Command: mocha
[builder:builder-core:end:2386] Ended with error: envs test - Command failed: /bin/sh -c mocha
Logged out PATH
in builder before exec contains bin with mocha: " /Users/rroemer/scm/fmd/builder-test/node_modules/.bin:/Users/rroemer/.nvm/v4.1.2/bin:/usr/local/heroku/bin:/Users/rroemer/.rvm/gems/ruby-2.0.0-p247/bin:/Users/rroemer/.rvm/gems/ruby-2.0.0-p247@global/bin:/Users/rroemer/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/rroemer/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Developer/Tools:/Users/rroemer/bin:/Users/rroemer/.gem/ruby/1.8/bin:./node_modules/.bin:/bin:/Users/rroemer/.rvm/bin"
from builder.
Cuhrazy. _.merge()
works differently for:
var taskShOpts = _.merge({}, shOpts, { env: taskEnv });
console.log("TODO HERE taskShOpts", taskShOpts.env);
in 0.10
:
{ MANPATH: '/Users/rroemer/.nvm/v0.10.40/share/man:',
NOTEBOOK_URL: 'http://localhost:8000',
rvm_bin_path: '/Users/rroemer/.rvm/bin',
VIRTUALENVWRAPPER_PROJECT_FILENAME: '.project',
// ... TONS OF STUFF ...
NODE_PATH: '/Users/rroemer/scm/fmd/builder-test/node_modules',
FOO: 1 }
vs. 0.4
:
{ FOO: 1 }
CULPRIT: Different _.merge()
behavior.
from builder.
@exogen -- The following code:
var taskShOpts = _.cloneDeep(shOpts);
taskShOpts.env = _.extend(taskShOpts.env, taskEnv);
appears to work for https://github.com/FormidableLabs/builder/blob/master/lib/runner.js#L231 if you've got a moment to refine that and PR it up...
from builder.
That is nuts, and I think I figured out why. merge
behaves differently based on the result of isPlainObject
.
In node 0.12:
> require("lodash").isPlainObject(process.env)
true
In node 4:
> require("lodash").isPlainObject(process.env)
false
So I think your solution works because cloneDeep
will turn env
into a plain object. I can open a PR shortly.
from builder.
Related Issues (20)
- Implementing the module pattern with typescript? HOT 5
- [Feature,Discussion]: Use in monorepos HOT 3
- The hardest part about Builder is making an Archetype. HOT 4
- How to extend an archetype. HOT 2
- Alternatives to "the module pattern". HOT 2
- To shrinkwrap or not to shrinkwrap? HOT 3
- Not using a dev archetype, but builder throws errors about not finding one. HOT 1
- How to configure default log-level?
- Chore: Bump to node4+ and modernize code.
- CI: Empty environment parameters are super-flaky on Appveyor.
- Log: Add `debug` log level.
- Eslint: Update to modern configs
- builder and mono repos HOT 4
- Nested builder command doesn't work in Windows. HOT 4
- Why does Bolt have many more stars than Builder?
- CI/Appveyor: Appveyor breaks on old npm
- Node8: Update code to modern ES
- builder is unable to resolve archetypes when builder is symlinked in from external node_modules. HOT 2
- when builder is symlinked, environment causes TypeScript compiler to fork bomb HOT 3
- Running coverage with typescript support (bug?) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from builder.