node version needs to be above 4
This is merely a suggestion, I was running node ~0.12 and I got this syntax error when running feathers generate complaining about syntax error "Use of const in strict mode". This was easily solved by upgrading node.
I thought the generator might be able to catch this by checking the node version first and maybe prompt to upgrade, much like you do with feathers itself.
The generator already checks for the Node version and if it is older than 5.0 adds Babel automatically as long as you start the server with npm start.
It might be just that we are shouldn't be using strict mode maybe. Thanks for the suggestion @af-bergstrom I think in a couple weeks time we'll start to really invest in the onboarding/CLI portion of things. We've had a lot of good feedback so there are some areas we can make it even easier to get ramped up with Feathers.
For Node 5 you need strict mode to use things like const and class in your files. What I'm saying is that the generated app should work with any Node version from 0.12 and up, there shouldn't be any errors.
The thing is, this was when I was trying to generate a new app.
I was able to reproduce on node v0.12.9 using the feathers-cli. @af-bergstrom did you not get a warning from Yeoman? I got some pretty visible ones...
npm install -g feathers-cli
npm WARN deprecated [email protected]: this package has been reintegrated into npm and is now out of date with respect to npm
> [email protected] postinstall /Users/eric/.nvm/versions/node/v0.12.9/lib/node_modules/feathers-cli/node_modules/generator-feathers/node_modules/yeoman-generator/node_modules/cross-spawn/node_modules/spawn-sync
> node postinstall
> [email protected] postinstall /Users/eric/.nvm/versions/node/v0.12.9/lib/node_modules/feathers-cli/node_modules/generator-feathers-plugin/node_modules/yeoman-generator/node_modules/cross-spawn/node_modules/spawn-sync
> node postinstall
/
> [email protected] postinstall /Users/eric/.nvm/versions/node/v0.12.9/lib/node_modules/feathers-cli/node_modules/yo
> yodoctor
Yeoman Doctor
Running sanity checks on your system
✔ Global configuration file is valid
✔ NODE_PATH matches the npm root
✖ Node.js version
Your Node.js version is outdated.
Upgrade to the latest version: https://nodejs.org
✔ No .bowerrc file in home directory
✔ No .yo-rc.json file in home directory
✖ npm version
Your npm version is outdated.
Upgrade to the latest version by running:
npm install -g npm
Found potential issues on your machine :(
/Users/eric/.nvm/versions/node/v0.12.9/bin/feathers -> /Users/eric/.nvm/versions/node/v0.12.9/lib/node_modules/feathers-cli/bin/feathers.js
[email protected] /Users/eric/.nvm/versions/node/v0.12.9/lib/node_modules/feathers-cli
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
eric : test $ feathers generate app
/Users/eric/.nvm/versions/node/v0.12.9/lib/node_modules/feathers-cli/node_modules/generator-feathers/generators/app/index.js:386
const devDependencies = [
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.defineProperty.get [as feathers:app] (/Users/eric/.nvm/versions/node/v0.12.9/lib/node_modules/feathers-cli/node_modules/yeoman-environment/lib/store.js:40:23)
at Store.get (/Users/eric/.nvm/versions/node/v0.12.9/lib/node_modules/feathers-cli/node_modules/yeoman-environment/lib/store.js:64:35)
at Environment.get (/Users/eric/.nvm/versions/node/v0.12.9/lib/node_modules/feathers-cli/node_modules/yeoman-environment/lib/environment.js:259:21)
Regardless, having some checks and warnings is definitely valuable. I'll add something to the docs and we should just create a separate issue in the Feathers CLI repo.
This is the complete dump from my bash
/Users/Rasmus/.node/lib/node_modules/feathers-cli/node_modules/generator-feathers/generators/app/index.js:386
const devDependencies = [
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.defineProperty.get [as feathers:app] (/Users/Rasmus/.node/lib/node_modules/feathers-cli/node_modules/yeoman-environment/lib/store.js:40:23)
at Store.get (/Users/Rasmus/.node/lib/node_modules/feathers-cli/node_modules/yeoman-environment/lib/store.js:64:35)
at Environment.get (/Users/Rasmus/.node/lib/node_modules/feathers-cli/node_modules/yeoman-environment/lib/environment.js:259:21)
~/Projects/Personal/feathers-chat ➔ node -v
v0.12.4
@af-bergstrom did you already have yeoman installed prior to running the CLI tool?
Ugh... the generator shouldn't use ES6. I guess I'm so used to it now that I didn't notice although I have no idea why the tests passed on 0.12.
Yes, I had yeoman installed
Let me just say I really like feathers and where it's going, you're doing a great job. My node was overdue for an update anyway :)
@daffl damn... glad we nailed it down though. I've created two separate issues to track this. Thanks for reporting @af-bergstrom!
https://github.com/feathersjs/feathers-cli/issues/24 https://github.com/feathersjs/generator-feathers/issues/118
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs.