angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Angular Cli Errors with nodejs 5.5.0

Open ahmed-musallam opened this issue 9 years ago • 7 comments

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) Mac OSX sierra and Jenkins CentOS 5

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here: beta.31

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

The log given by the failure.

Normally this include a stack trace and some more information.

  constructor(schema, value, ...fallbacks) {
                               ^^^

SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/@angular/cli/node_modules/@ngtools/json-schema/src/index.js:2:30)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)

Also this:

SyntaxError: Unexpected token =
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/data4/hudson/workspace/ui.resources/node_modules/@angular/cli/models/config.js:2:18)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)

Mention any other details that might be useful.

Yesterday @ngtools/[email protected] was updated to 1.0.3 and also @ngtools/[email protected] was updated to 1.2.9

Seems like those two updates introduces ES2016 syntax that Node 5.5.0 does not like. I know angular cli team did their due diligence and mentioned that node < 6.9 will no longer be supported... BUT, it would have been nice if you could at least pin the versions

Those two releases mentioned above, should have been minor releases. Additionally, @angular/[email protected] should have had the following dependencies: "@ngtools/json-schema":"1.0.x" instead of "^1.0.0" and "@ngtools/webpack":"1.2.x" instead of "^1.2.3"

I appreciate all the hard work from angular team. I am not aware of your development process but s an outsider, that's what I think.

I found a solution to this, please find it it in the comments


Thanks! We'll be in touch soon.

ahmed-musallam avatar Feb 10 '17 17:02 ahmed-musallam

OBVIOUSLY, the best solution would be to update to the supported Node 6.9 but in my case, it was out of my hand

The solution that fixed those issues for me on node 5.5.0 was npm shrinkwrap Basically, we want to make sure we get the versions of @ngtools/webpack and @ngtools/json-schema that work in node 5.5.0

here is the solution

rm -rf node_modules  #remove all installed modules

npm install #install al modules back

npm remove @ngtools/webpack
npm install @ngtools/[email protected] # install the specific version that works with node 5.5.0

npm remove @ngtools/json-schema
npm install @ngtools/[email protected] # install the specific version that works with node 5.5.0

npm shrinkwrap --dev  #if it throws errors about extraneous dependencies, use npm prune 

a new npm-shrinkwrap.json file is generated and will guarantee that you get the specified versions above

read more about srinkwrap here

ahmed-musallam avatar Feb 10 '17 17:02 ahmed-musallam

+1

RichardSilveira avatar Feb 10 '17 17:02 RichardSilveira

We do not support Node version before 6.9. The Beta 28.3 was the last version to support Node 4 and 5.

hansl avatar Feb 10 '17 17:02 hansl

@hansl from the CHANGELOG.md for beta 28:

angular-cli: Node < 6.9 will be deprecated soon, and this will show a warning to users. Moving forward, that warning will be moved to an error with the next release.

I saw the warning, but there was NO error that told me that you don't support Node version before 6.9. according to above, I expected an error that breaks the build and mentions that it wont work because of node version...

ahmed-musallam avatar Feb 10 '17 18:02 ahmed-musallam

So, this error is happening in my build server and local machine, both with node 5.5. My app it's using the version beta-19 of angular-cli, and updating my local machine and my build server to node 6.9.5, everything is working fine...

RichardSilveira avatar Feb 10 '17 21:02 RichardSilveira

Our build server also fails with beta.28.3, probably [email protected] and [email protected] are not locked and install more recent version automatically on build that go through npm install steps. I would still see this as an issue, if beta.28.3 is the last version which should work on node 5... We will ask admins to update the node version on the build server, but I completely understand that sometimes it's not possible.

ubarevicius avatar Feb 13 '17 15:02 ubarevicius

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.