meanjs / generator-meanjs

MEAN.JS Official Yeoman Generator
http://meanjs.org/
473 stars 178 forks source link

App build fails after customizing the app #210

Open vinayakvinay opened 8 years ago

vinayakvinay commented 8 years ago

@ilanbiala @codydaig

Hello there,

I have latest mean generator installed in my machine. I use yo meanjs to scaffold the MEAN app. When I edit the crud module what I generated the test results 50 lines of warning and error. I reverted all the changes I done and set the app to fresh/initial state what yeoman generated but still I am getting the following errors.

`vinayak@vinayak-Lenovo-G500:/var/www/html/yeoman/vin$ cd vinayaka && grunt Running "env:dev" (env) task

Running "sass:dist" (sass) task

Running "less:dist" (less) task

Running "eslint:target" (eslint) task

/var/www/html/yeoman/vin/vinayaka/gruntfile.js 268:11 warning Unexpected console statement no-console 270:11 warning Unexpected console statement no-console

/var/www/html/yeoman/vin/vinayaka/config/config.js 58:3 warning Unexpected console statement no-console 61:7 warning Unexpected console statement no-console 63:7 warning Unexpected console statement no-console 68:3 warning Unexpected console statement no-console 85:5 warning Unexpected console statement no-console 86:5 warning Unexpected console statement no-console 87:5 warning Unexpected console statement no-console 103:7 warning Unexpected console statement no-console 104:7 warning Unexpected console statement no-console 105:7 warning Unexpected console statement no-console 106:7 warning Unexpected console statement no-console

/var/www/html/yeoman/vin/vinayaka/config/lib/app.js 14:5 warning Unexpected console statement no-console 45:7 warning Unexpected console statement no-console 46:7 warning Unexpected console statement no-console 47:7 warning Unexpected console statement no-console 48:7 warning Unexpected console statement no-console 49:7 warning Unexpected console statement no-console 50:7 warning Unexpected console statement no-console 51:7 warning Unexpected console statement no-console 53:9 warning Unexpected console statement no-console 54:7 warning Unexpected console statement no-console

/var/www/html/yeoman/vin/vinayaka/config/lib/express.js 202:5 warning Unexpected console statement no-console

/var/www/html/yeoman/vin/vinayaka/config/lib/logger.js 34:7 warning Unexpected console statement no-console 35:7 warning Unexpected console statement no-console 36:7 warning Unexpected console statement no-console 100:9 warning Unexpected console statement no-console 101:9 warning Unexpected console statement no-console 102:9 warning Unexpected console statement no-console 103:9 warning Unexpected console statement no-console

/var/www/html/yeoman/vin/vinayaka/config/lib/mongoose.js 28:7 warning Unexpected console statement no-console 29:7 warning Unexpected console statement no-console 43:5 warning Unexpected console statement no-console

/var/www/html/yeoman/vin/vinayaka/config/lib/seed.js 60:9 warning Unexpected console statement no-console 105:7 warning Unexpected console statement no-console 106:7 warning Unexpected console statement no-console 107:7 warning Unexpected console statement no-console

/var/www/html/yeoman/vin/vinayaka/modules/inwards/server/controllers/inwards.server.controller.js 39:115 error Unnecessary use of boolean literals in conditional expression no-unneeded-ternary 48:27 error Unexpected whitespace before semicolon semi-spacing 50:28 error There should be no space before ',' comma-spacing 67:27 error Unexpected whitespace before semicolon semi-spacing 83:36 error Trailing spaces not allowed no-trailing-spaces

/var/www/html/yeoman/vin/vinayaka/modules/inwards/client/inwards.client.module.js 1:1 error Move the invocation into the parens that contain the function wrap-iife

/var/www/html/yeoman/vin/vinayaka/modules/inwards/client/config/inwards.client.config.js 1:1 error Move the invocation into the parens that contain the function wrap-iife

/var/www/html/yeoman/vin/vinayaka/modules/inwards/client/config/inwards.client.routes.js 1:1 error Move the invocation into the parens that contain the function wrap-iife 36:11 error Extra space after key 'pageTitle' key-spacing 60:14 error Missing space before value for key 'data' key-spacing

/var/www/html/yeoman/vin/vinayaka/modules/inwards/client/controllers/inwards.client.controller.js 1:1 error Move the invocation into the parens that contain the function wrap-iife 23:11 warning Unexpected confirm no-alert

/var/www/html/yeoman/vin/vinayaka/modules/inwards/client/controllers/list-inwards.client.controller.js 1:1 error Move the invocation into the parens that contain the function wrap-iife

/var/www/html/yeoman/vin/vinayaka/modules/inwards/client/services/inwards.client.service.js 1:1 error Expected space or tab after '//' in comment spaced-comment 2:1 error Move the invocation into the parens that contain the function wrap-iife

/var/www/html/yeoman/vin/vinayaka/modules/inwards/tests/server/inward.server.model.tests.js 14:11 error Expected variable declaration to be on a new line one-var-declaration-per-line 30:27 error Trailing spaces not allowed no-trailing-spaces 49:89 error Trailing spaces not allowed no-trailing-spaces 59:29 error Trailing spaces not allowed no-trailing-spaces 60:36 error Missing space before opening brace space-before-blocks 61:36 error Missing space before opening brace space-before-blocks 62:16 error Trailing spaces not allowed no-trailing-spaces

/var/www/html/yeoman/vin/vinayaka/modules/inwards/tests/server/inward.server.routes.tests.js 14:10 error Expected variable declaration to be on a new line one-var-declaration-per-line 14:17 error Expected variable declaration to be on a new line one-var-declaration-per-line 14:30 error Expected variable declaration to be on a new line one-var-declaration-per-line 14:36 error Expected variable declaration to be on a new line one-var-declaration-per-line

/var/www/html/yeoman/vin/vinayaka/modules/inwards/tests/client/inwards.client.controller.tests.js 1:1 error Move the invocation into the parens that contain the function wrap-iife 66:7 error Expected space or tab after '//' in comment spaced-comment 144:9 error Expected space or tab after '//' in comment spaced-comment 149:9 error Expected space or tab after '//' in comment spaced-comment 161:9 error Expected space or tab after '//' in comment spaced-comment

/var/www/html/yeoman/vin/vinayaka/modules/inwards/tests/client/inwards.client.routes.tests.js 1:1 error Move the invocation into the parens that contain the function wrap-iife 9:5 error Expected space or tab after '//' in comment spaced-comment 56:11 error Expected space or tab after '//' in comment spaced-comment 103:11 error Expected space or tab after '//' in comment spaced-comment 152:11 error Expected space or tab after '//' in comment spaced-comment

/var/www/html/yeoman/vin/vinayaka/modules/inwards/tests/client/list-inwards.client.controller.tests.js 1:1 error Move the invocation into the parens that contain the function wrap-iife 65:7 error Expected space or tab after '//' in comment spaced-comment

✖ 76 problems (37 errors, 39 warnings)

Warning: Task "eslint:target" failed. Use --force to continue.

Aborted due to warnings. `

ilanbiala commented 8 years ago

@vinayakvinay these are just linting errors, did you use master as your version?

vinayakvinay commented 8 years ago

Yes I tried with master, 0.4.0, and 0.4.1. For all the three, it produces the same lint error.

ilanbiala commented 8 years ago

@vinayakvinay, the code you added doesn't pass the style guide checks, so if you fix it and the error statements go away, then the build will continue. The warnings are just suggestions.

vinayakvinay commented 8 years ago

@ilanbiala I have to grunt --force to run the app. I haven't made any changes in the source code except page title. I am still getting the same lint errors. Is that related to my node version? I am on node 5.6.0 | npm 3.6.0. I updated yeoman and mean generator to latest.

vinayakvinay commented 8 years ago

@ilanbiala @codydaig Just figured out what causes the lint error. When I add crud module using the sub gen it produces the lint errors and by default there are 38 lint warnings during app build.

I tried with master, 0.4.0 and 0.4.1 and faced the same kind of error. As you said, the lint warnings are just suggestions only but yo meanjs:crud-module is a real deal breaker for me here.

I believe the mean gen is a fantastic outcome from mean js team that's why I choose mean generator for my app development. Please help me out to get rid of this issue.

I am ready to downgrade / upgrade any piece of package if necessary. If you could suggest me prerequisites with their versions to use all the features of yo meanjs then it would be great. Right now, I am on node 5.6.0, npm 3.6.0, latest version of yeoman, grunt-cli, bower, etc.,

stephengtuggy commented 8 years ago

@vinayakvinay Maybe try node version 4.x LTS instead? At least, that is what worked for me. Then run sudo npm install -g npm to upgrade to the latest npm version after you have node 4.x installed.

You said you edited the crud module that was generated. Can you attach your edited code?

stephengtuggy commented 8 years ago

@ilanbiala and @codydaig I hope you guys don't mind me jumping in here.

vinayakvinay commented 8 years ago

@stephengtuggy As you said, I just downgraded to node 4.4.1 LTS and updated the npm version to the latest. I think its not related to customization of crud module which I was thinking the reason for lint errors initially. Whenever I add a crud module using yo meanjs:crud-module I get the lint error and app build fails. I have to grunt force to continue.

vinayakvinay commented 8 years ago

@ilanbiala @codydaig Pls help me to solve my lint errors after adding a crud-module.

vinayakvinay commented 8 years ago

@ilanbiala @codydaig I did try grunt --force to bypass the lint errors and ended up in Uncaught Error: [$injector:unpr] Unknown provider: MenusProvider <- Menus after adding a crud-module.

stephengtuggy commented 8 years ago

@vinayakvinay Hmm. I am unable to reproduce your issues.

p3p3k commented 8 years ago

i have same problem. @vinayakvinay Did you solve this problem?

vinayakvinay commented 8 years ago

@p3p3k Not yet resolved. Waiting for @ilanbiala to help us.

ilanbiala commented 8 years ago

@vinayakvinay sorry I've been caught up with other stuff. There don't seem to be any linting errors in our tests. Can you try from scratch?

vinayakvinay commented 8 years ago

@ilanbiala Yes I did try from the scratch. The very first build itself has 37 lint warning with out modifying/adding anything to source code and I have to grunt --force to continue. Once I add crud module the error became 76 and again I tried grunt --force but I can't see anything in the screen since it shows me Angular Unknown menu provider error in browsers' console.

axke commented 8 years ago

@vinayakvinay I also noticed the lint errors, however, they've not been an issue for me.

In regards to the menu provider error, it seems to be because the meanjs core (master branch) names the menu service menuService, where as the crud-module generator injects Menus (0.4.x branch of meanjs uses this name).

The issue is in modules/{module}/client/config/{module}.client.config.js

menuConfig.$inject = ['Menus'];

If you're using the master branch of meanjs, I believe it should inject 'menuService' vs 'Menus'

vinayakvinay commented 8 years ago

@alexisio Thank you so much for the detailed explanation.

jedau commented 8 years ago

@alexisio I had the same problem with the blank display when I encountered Error: [$injector:unpr] Unknown provider: MenusProvider <- Menus. It was already:

menuConfig.$inject = ['menuService'];

I tried to change menuConfig.$inject in /modules/customers/client/config/customers.client.config.js to topbar, but it didn't do anything. I just reverted it back to menuService and it finally worked properly. I'm not quite sure what happened. Should I change the value to Menus or what? I'm not clear why it didn't work the first time when it already had menuService as the value in the array.

axke commented 8 years ago

@jedau

Error: [$injector:unpr] Unknown provider: MenusProvider <- Menus makes it sound like the service being injected was Menus (which is what the crud-module generator does by default right now).

If you're using the 0.5.0-beta branch (which last I checked is the master branch), the menu service to be injected is menuService. If you are using 0.4.x, Menus would be expected.

jedau commented 8 years ago

@alexisio oh so I guess I'm using 0.5.0-beta because menuService was injected by default. I'm curious though, why did it throw that error for me? It has menuService as the value, then an error was thrown, so I changed it to topbar (because reasons) and that obviously didn't work, so I changed it back to menuService and then it suddenly worked! I'm not complaining or anything, just wondering why.

vineeshc9 commented 8 years ago

I am also receiving the same issue in gruntfile.js config.js development.js app.js express.js logger.js mongoose.js seed.js socket.io.js

of Unexpected console statement no-console.

Can anyone help out.

codydaig commented 8 years ago

@vineeshc9 The no-console's are only warnings, and don't actually fail the build.

Valonix commented 8 years ago

/opt/mean/modules/products/server/controllers/products.server.controller.js 39:118 error Unnecessary use of boolean literals in conditional expression no-unneeded-ternary 48:29 error Unexpected whitespace before semicolon semi-spacing 50:30 error There should be no space before ',' comma-spacing 67:29 error Unexpected whitespace before semicolon semi-spacing 83:36 error Trailing spaces not allowed no-trailing-spaces

/opt/mean/modules/products/client/products.client.module.js 1:1 error Move the invocation into the parens that contain the function wrap-iife

/opt/mean/modules/products/client/config/products.client.config.js 1:1 error Move the invocation into the parens that contain the function wrap-iife

/opt/mean/modules/products/client/config/products.client.routes.js 1:1 error Move the invocation into the parens that contain the function wrap-iife 36:11 error Extra space after key 'pageTitle' key-spacing 60:14 error Missing space before value for key 'data' key-spacing

/opt/mean/modules/products/client/controllers/list-products.client.controller.js 1:1 error Move the invocation into the parens that contain the function wrap-iife

/opt/mean/modules/products/client/controllers/products.client.controller.js 1:1 error Move the invocation into the parens that contain the function wrap-iife 23:11 warning Unexpected confirm no-alert

/opt/mean/modules/products/client/services/products.client.service.js 1:1 error Expected space or tab after '//' in comment spaced-comment 2:1 error Move the invocation into the parens that contain the function wrap-iife

/opt/mean/modules/products/tests/server/product.server.model.tests.js 14:11 error Expected variable declaration to be on a new line one-var-declaration-per-line 30:27 error Trailing spaces not allowed no-trailing-spaces 49:89 error Trailing spaces not allowed no-trailing-spaces 59:29 error Trailing spaces not allowed no-trailing-spaces 60:37 error Missing space before opening brace space-before-blocks 61:36 error Missing space before opening brace space-before-blocks 62:16 error Trailing spaces not allowed no-trailing-spaces

/opt/mean/modules/products/tests/server/product.server.routes.tests.js 14:10 error Expected variable declaration to be on a new line one-var-declaration-per-line 14:17 error Expected variable declaration to be on a new line one-var-declaration-per-line 14:30 error Expected variable declaration to be on a new line one-var-declaration-per-line 14:36 error Expected variable declaration to be on a new line one-var-declaration-per-line

/opt/mean/modules/products/tests/client/list-products.client.controller.tests.js 1:1 error Move the invocation into the parens that contain the function wrap-iife 65:7 error Expected space or tab after '//' in comment spaced-comment

/opt/mean/modules/products/tests/client/products.client.controller.tests.js 1:1 error Move the invocation into the parens that contain the function wrap-iife 66:7 error Expected space or tab after '//' in comment spaced-comment 144:9 error Expected space or tab after '//' in comment spaced-comment 149:9 error Expected space or tab after '//' in comment spaced-comment 161:9 error Expected space or tab after '//' in comment spaced-comment

/opt/mean/modules/products/tests/client/products.client.routes.tests.js 1:1 error Move the invocation into the parens that contain the function wrap-iife 9:5 error Expected space or tab after '//' in comment spaced-comment 56:11 error Expected space or tab after '//' in comment spaced-comment 103:11 error Expected space or tab after '//' in comment spaced-comment 152:11 error Expected space or tab after '//' in comment spaced-comment

✖ 38 problems (37 errors, 1 warning)

codydaig commented 8 years ago

@Valonix Can you provide some context around that error message? What did you run to generate it, and any other details you can provide. Just pasting error messages doesn't help my ability to fix the issue.

Valonix commented 8 years ago

@codydaig i installed crud generator like in docs on site. Then i created module "products" Then after i wrote grunt i saw this list of errors. I checked the code, and you know what? It rly have errors, i was shocked, why people released this? All files with errors.... Uncorrected brackets, unnecessary semicolon .... =|

codydaig commented 8 years ago

There is an update coming soon. If you use the master branch of this repo, it should work and we will be publishing to npm in the coming days.