Angular-cli: ng -v error reflect-metadata after update cli version beta.20-1

Created on 16 Nov 2016  路  17Comments  路  Source: angular/angular-cli

Please provide us with the following information:

OS?

ubuntu 14.04

Versions.

[email protected]
node 7.0.0
npm 3.10.9

Repro steps.

update latest cli

npm rm -g angular-cli
npm i -g angular-cli

then

ng -v

have done the same with npm cache clean, same error

The log given by the failure.

$ ng -v
Cannot find module 'reflect-metadata'
Error: Cannot find module 'reflect-metadata'

Mention any other details that might be useful.

Also when doing npm ls -g --depth=0 shows

npm ERR! peer dep missing: @angular/compiler-cli@^2.1.0, required by @ngtools/[email protected]
npm ERR! peer dep missing: @angular/core@^2.0.0, required by @ngtools/[email protected]
npm ERR! peer dep missing: reflect-metadata@^0.1.8, required by @ngtools/[email protected]

didn't happen in previous version.


Thanks! We'll be in touch soon.

Most helpful comment

Same here :(
angular-cli: v1.0.0-beta.20-1
OS: Mac os 10.10.1
nodejs: 7.0.0
npm: 3.10.9

All 17 comments

full stack traces

$ ng -v
Cannot find module 'reflect-metadata'
Error: Cannot find module 'reflect-metadata'
    at Function.Module._resolveFilename (module.js:472:15)
    at Function.Module._load (module.js:420:25)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/antony-budianto/.nvm/versions/node/v7.0.0/lib/node_modules/angular-cli/node_modules/@ngtools/webpack/src/index.js:5:1)
    at Module._compile (module.js:573:32)
    at Object.Module._extensions..js (module.js:582:10)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/antony-budianto/.nvm/versions/node/v7.0.0/lib/node_modules/angular-cli/models/webpack-build-typescript.js:5:17)
    at Module._compile (module.js:573:32)
    at Object.Module._extensions..js (module.js:582:10)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/antony-budianto/.nvm/versions/node/v7.0.0/lib/node_modules/angular-cli/models/webpack-config.js:2:34)
    at Module._compile (module.js:573:32)
    at Object.Module._extensions..js (module.js:582:10)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/antony-budianto/.nvm/versions/node/v7.0.0/lib/node_modules/angular-cli/tasks/build-webpack.js:6:24)
    at Module._compile (module.js:573:32)
    at Object.Module._extensions..js (module.js:582:10)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/antony-budianto/.nvm/versions/node/v7.0.0/lib/node_modules/angular-cli/commands/build.js:3:23)
    at Module._compile (module.js:573:32)
    at Object.Module._extensions..js (module.js:582:10)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)
    at Class.includedCommands (/home/antony-budianto/.nvm/versions/node/v7.0.0/lib/node_modules/angular-cli/addon/index.js:21:16)
    at /home/antony-budianto/.nvm/versions/node/v7.0.0/lib/node_modules/angular-cli/angular-cli/lib/models/project.js:392:61
    at Array.forEach (native)
    at Project.addonCommands (/home/antony-budianto/.nvm/versions/node/v7.0.0/lib/node_modules/angular-cli/angular-cli/lib/models/project.js:391:15)
    at Project.eachAddonCommand (/home/antony-budianto/.nvm/versions/node/v7.0.0/lib/node_modules/angular-cli/angular-cli/lib/models/project.js:426:30)
    at module.exports (/home/antony-budianto/.nvm/versions/node/v7.0.0/lib/node_modules/angular-cli/angular-cli/lib/cli/lookup-command.js:33:13)
    at CLI.<anonymous> (/home/antony-budianto/.nvm/versions/node/v7.0.0/lib/node_modules/angular-cli/angular-cli/lib/cli/cli.js:34:26)
    at tryCatch (/home/antony-budianto/.nvm/versions/node/v7.0.0/lib/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:538:12)
    at invokeCallback (/home/antony-budianto/.nvm/versions/node/v7.0.0/lib/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:553:13)
    at publish (/home/antony-budianto/.nvm/versions/node/v7.0.0/lib/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:521:7)
    at flush (/home/antony-budianto/.nvm/versions/node/v7.0.0/lib/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:2373:5)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

The same error.
angular-cli: v1.0.0-beta.20-1
OS: windows 10 x64
nodejs: 7.0.0
qq 20161116114528

Got the same error with same stack trace
angular-cli: v1.0.0-beta.20-1
OS: macOS Sierra
nodejs: 6.7.0

Can't even run ng version ... same error
angular-cli: v1.0.0-beta.20-1
OS: Windows 7 x64
nodejs: 5.12.0

Same here :(
angular-cli: v1.0.0-beta.20-1
OS: Mac os 10.10.1
nodejs: 7.0.0
npm: 3.10.9

"ng " doesn't run anymore!, I get the same error
event after installing it globally, can't event run "ng -v"!

[email protected]
OS: Kubuntu 16.04
node: v6.9.1
npm: 3.10.8

Same problem
[email protected]
OS: Mac OS 10.12.1 (16B2555)
node: v7.1.0
npm: 4.0.2

A temporary fix that worked for me:
Add these to your package.json (change the version of @angular/compiler-cli to the exact same version you have for @angular/core)

 "@angular/compiler-cli": "2.2.0",
 "reflect-metadata": "^0.1.8"

And for running ng ... don't use your global angular-cli , instead add it to your package.json and run it with npm (so it's gonna use your local angular-cli)

 "scripts": {
    ...
    "build-my-app": "ng build --prod --aot --xyz"
 },

and to run it

 npm run build-my-app

I managed to get this working this way
npm i -g reflect-metadata

However I installed angular-cli locally ( just like @monfa-red )
npm i angular-cli

Followed by these
npm i reflect-metadata
npm i zone.js@^0.6.21
npm i -g [email protected]
npm i @angular/core
npm i @angular/compiler-cli
npm i @angular/compiler

Followed by ng -v
angular-cli: 1.0.0-beta.20-1
node: 6.9.1
os: win32 x64

solve this by rolling back to the last usable version 1.0.0-beta.19-3
npm i -g [email protected]

Same issue. I tried to update my application to 20-1 and its breaking. So i rolled back to 19-3
I think it's related to some dependency.

Looking into it. I'm going to release 20-2 soon. Stay tuned.

Beta 20-1 is released as experimental. Latest tag as been set back to 19-3 while we see if this one is good.

Alright this is fixed and published. Sorry all for the inconvenience.

Is it the latest?

Hi there, my experimental solution in Windows for now is:
-Got to directory: C:\Users\"Your User"\AppData\Roamingnpmnode_modulesangular-cli

  • npm install reflect-metadata
  • npm install portfinder

It麓s working for me and apply for any platform if you can access the final path as above.
Hope this help.

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._

Was this page helpful?
0 / 5 - 0 ratings