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

TypeError: undefined is not a function #9

Closed
trevordmiller opened this issue Sep 3, 2015 · 4 comments
Closed

TypeError: undefined is not a function #9

trevordmiller opened this issue Sep 3, 2015 · 4 comments

Comments

@trevordmiller
Copy link

First off, awesome package! Great work. It has been very helpful so far as I am transitioning to using npm scripts instead of Gulp/Grunt. I'm just running into one issue: when I run my npm run dev script, which uses npm-run-all I get a TypeError: undefined is not a function error, which is preventing my lint:watch script from running. I have done some debugging, and everything works as expected running npm run lint:watch by itself, or npm run dev without the lint:watch command...but I don't know how to debug it. Is this a known issue with npm-run-all?

Related issue

I don't know if this is an issue with eslint-watch or npm-run-all, so I have posted the issue in both places. I do know that all of my other packages work as expected so something seems to be wrong with either eslint-watch or npm-run-all.

rizowski/eslint-watch#28

Steps to reproduce:

screen shot 2015-09-03 at 12 56 44 pm

@mysticatea
Copy link
Owner

Thank you for the report!

I will dig this this evening (JST).

@mysticatea
Copy link
Owner

Sorry for my delay.
I published fixed version!

@trevordmiller
Copy link
Author

@mysticatea Awesome. Thank you!

@tech-consortium
Copy link

tech-consortium commented Apr 25, 2020

@mysticatea Why if a variable is not set do you set it to undefined instead of just leaving it alone?

For example, if we have these two scripts.

"cross-vars:echo": "cross-vars echo "Node Environment = $node_env \ NPM Production = $npm_config_production"",

"cross-env:echo": "cross-env echo "Node Environment = $node_env \ NPM Production = $npm_config_production"",

If NODE_ENV=production then both cross-env and cross-vars returns production. But if NODE_ENV doesn't exist then that's where there is a difference. With cross-env it just leaves it unset so there is no value in echo'd for node_env as we would expect. But with cross-vars it actually sets $NODE_ENV to "undefined". Now imagine you were actually calling and angular build with a script like this...

"build": "cross-vars ng build --configuration=$node_env",

If $node_env isn't set to anything, then instead of $node_env being literally undefined or set to nothing, cross-vars is setting it to the actual string "undefined". Having --configuration=undefined is going to cause the ng build to fail because there is no such thing as an "undefined" configuration environment. Why don't you just leave the variable value alone if it's undefined?

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

No branches or pull requests

3 participants