angular-fullstack / generator-angular-fullstack

Yeoman generator for an Angular app with an Express server
https://awk34.gitbook.io/generator-angular-fullstack
6.12k stars 1.24k forks source link

upgrade to Babel 6.0 #1563

Closed rassiel closed 8 years ago

rassiel commented 8 years ago

How about upgrading to Babel 6.0? I tried doing that myself but I haven't been able to successfully run the unit tests. please check my repo if you like: https://github.com/rassiel/automa I added: .babelrc Gruntfile.js modified the require: ['babel-register','mocha.conf.js'], in mochaTest task mocha.conf.js removed require('babel-core/register'); but still getting error when doing grunt mochaTest:unit

[4mRunning "mochaTest:unit" (mochaTest) task[24m [31m>> [39mMocha exploded! [31m>> [39mError: Cannot find module './undefined.js'[31m [39m at Function.Module._resolveFilename (module.js:325:15)[31m [39m at Function.Module._load (module.js:276:25)[31m [39m at Proxyquire._require (C:\git\automa\node_modules\proxyquire\lib\proxyquire.js:164:19)[31m [39m at require (internal/module.js:12:17)[31m [39m at Object. (index.js:50:3)[31m [39m at Module._compile (module.js:397:26)[31m [39m at loader (C:\git\automa\node_modules\babel-register\lib\node.js:130:5)[31m [39m at Object.require.extensions.(anonymous function) as .js[31m [39m at Object.require.extensions.(anonymous function) (C:\git\automa\node_modules\proxyquire\lib\proxyquire.js:243:43)[31m [39m at Module.load (module.js:343:32)[31m [39m at Function.Module._load (module.js:300:12)[31m [39m at Proxyquire._require (C:\git\automa\node_modules\proxyquire\lib\proxyquire.js:164:19)[31m [39m at require (internal/module.js:12:17)[31m [39m at Object. (user.controller.js:128:29)[31m [39m at Module._compile (module.js:397:26)[31m [39m at loader (C:\git\automa\node_modules\babel-register\lib\node.js:130:5)[31m [39m at Object.require.extensions.(anonymous function) as .js[31m [39m at Object.require.extensions.(anonymous function) (C:\git\automa\node_modules\proxyquire\lib\proxyquire.js:243:43)[31m [39m at Module.load (module.js:343:32)[31m [39m at Function.Module._load (module.js:300:12)[31m [39m at Proxyquire._require (C:\git\automa\node_modules\proxyquire\lib\proxyquire.js:151:36)[31m [39m at require (internal/module.js:12:17)

Awk34 commented 8 years ago

1399

nicarq commented 8 years ago

There is an issue in:

server/config/environment/index.js

specificly here:

// Export the config object based on the NODE_ENV
// ==============================================
module.exports = _.merge(
  all,
  require('./shared'),
  require('./' + process.env.NODE_ENV + '.js') : {});

If the NODE_ENV is undefined. It still tries to read it and it throws that error. I was able to fix it doing this:

// Export the config object based on the NODE_ENV
// ==============================================
var processRequire = process.env.NODE_ENV != undefined ? require('./' + process.env.NODE_ENV + '.js') : {};
module.exports = _.merge(
  all,
  require('./shared'),
  processRequire);
rassiel commented 8 years ago

oh @Nykho thanks a lot!! Now I'm getting another error... I've couldn't found the cause so far... This is the error:

[4mRunning "mochaTest:unit" (mochaTest) task[24m
[31m [39mMocha exploded!
[31m [39mTypeError: require(...) is not a function[31m
 [39m    at Object.<anonymous> (app.js:30:29)[31m
 [39m    at Module._compile (module.js:397:26)[31m
 [39m    at loader (C:\git\automa\node_modules\babel-register\lib\node.js:131:5)[31m
 [39m    at Object.require.extensions.(anonymous function) [as .js] (C:\git\automa\node_modules\babel-register\lib\node.js:141:7)[31m
 [39m    at Module.load (module.js:343:32)[31m
 [39m    at Function.Module._load (module.js:300:12)[31m
 [39m    at Module.require (module.js:353:17)[31m
 [39m    at require (internal/module.js:12:17)[31m
 [39m    at Object.<anonymous> (index.js:12:28)[31m
 [39m    at Module._compile (module.js:397:26)[31m
 [39m    at loader (C:\git\automa\node_modules\babel-register\lib\node.js:131:5)[31m
 [39m    at Object.require.extensions.(anonymous function) [as .js] (C:\git\automa\node_modules\babel-register\lib\node.js:141:7)[31m
 [39m    at Module.load (module.js:343:32)[31m
 [39m    at Function.Module._load (module.js:300:12)[31m
 [39m    at Module.require (module.js:353:17)[31m
 [39m    at require (internal/module.js:12:17)[31m
 [39m    at Object.<anonymous> (user.model.spec.js:1:14)[31m
 [39m    at Module._compile (module.js:397:26)[31m
 [39m    at loader (C:\git\automa\node_modules\babel-register\lib\node.js:131:5)[31m
 [39m    at Object.require.extensions.(anonymous function) [as .js] (C:\git\automa\node_modules\babel-register\lib\node.js:141:7)[31m
 [39m    at Module.load (module.js:343:32)[31m
 [39m    at Function.Module._load (module.js:300:12)
[33mWarning: Task "mochaTest:unit" failed. Use --force to continue.[39m

[31mAborted due to warnings.[39m

Execution Time (2016-01-25 17:21:28 UTC)
loading tasks             238ms  █████ 13%
loading grunt-mocha-test   46ms  █ 3%
mochaTest:unit             1.5s  ███████████████████████████████ 84%
Total 1.8s
nschurmann commented 8 years ago

I'm getting this error too. Any fix for this?