Skip to content

Cannot find module 'reflect-metadata' #2522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MuhammadUzair opened this issue Oct 5, 2016 · 26 comments
Closed

Cannot find module 'reflect-metadata' #2522

MuhammadUzair opened this issue Oct 5, 2016 · 26 comments

Comments

@MuhammadUzair
Copy link

MuhammadUzair commented Oct 5, 2016

OS

Windows10

Versions.

If run ng --version. Then give error : Cannot find module 'reflect-metadata'

Node versions:v4.5.0

Repro steps.

run npm install angular-cli -g
Error on this ng new hello

Thanks

The log file is following.

0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'reflect-metadata' ]
2 info using [email protected]
3 info using [email protected]
4 verbose install initial load of C:\Users\UZAIR\AppData\Roaming\npm\package.json
5 verbose readDependencies loading dependencies from C:\Users\UZAIR\AppData\Roaming\npm\package.json
6 silly cache add args [ 'reflect-metadata', null ]
7 verbose cache add spec reflect-metadata
8 silly cache add parsed spec Result {
8 silly cache add raw: 'reflect-metadata',
8 silly cache add scope: null,
8 silly cache add name: 'reflect-metadata',
8 silly cache add rawSpec: '',
8 silly cache add spec: 'latest',
8 silly cache add type: 'tag' }
9 silly addNamed reflect-metadata@latest
10 verbose addNamed "latest" is being treated as a dist-tag for reflect-metadata
11 info addNameTag [ 'reflect-metadata', 'latest' ]
12 silly mapToRegistry name reflect-metadata
13 silly mapToRegistry using default registry
14 silly mapToRegistry registry https://registry.npmjs.org/
15 silly mapToRegistry data Result {
15 silly mapToRegistry raw: 'reflect-metadata',
15 silly mapToRegistry scope: null,
15 silly mapToRegistry name: 'reflect-metadata',
15 silly mapToRegistry rawSpec: '',
15 silly mapToRegistry spec: 'latest',
15 silly mapToRegistry type: 'tag' }
16 silly mapToRegistry uri https://registry.npmjs.org/reflect-metadata
17 verbose addNameTag registry:https://registry.npmjs.org/reflect-metadata not in flight; fetching
18 verbose request uri https://registry.npmjs.org/reflect-metadata
19 verbose request no auth needed
20 info attempt registry request try #1 at 1:58:49 PM
21 verbose request id cffd0e6fc6f18695
22 verbose etag "3FUNPAFFOC9BUD78M5LTTM94C"
23 http request GET https://registry.npmjs.org/reflect-metadata
24 http 304 https://registry.npmjs.org/reflect-metadata
25 verbose headers { date: 'Wed, 05 Oct 2016 08:58:58 GMT',
25 verbose headers via: '1.1 varnish',
25 verbose headers 'cache-control': 'max-age=300',
25 verbose headers etag: '"3FUNPAFFOC9BUD78M5LTTM94C"',
25 verbose headers age: '219',
25 verbose headers connection: 'keep-alive',
25 verbose headers 'x-served-by': 'cache-lhr6337-LHR',
25 verbose headers 'x-cache': 'HIT',
25 verbose headers 'x-cache-hits': '204',
25 verbose headers 'x-timer': 'S1475657938.353556,VS0,VE0',
25 verbose headers vary: 'Accept-Encoding' }
26 silly get cb [ 304,
26 silly get { date: 'Wed, 05 Oct 2016 08:58:58 GMT',
26 silly get via: '1.1 varnish',
26 silly get 'cache-control': 'max-age=300',
26 silly get etag: '"3FUNPAFFOC9BUD78M5LTTM94C"',
26 silly get age: '219',
26 silly get connection: 'keep-alive',
26 silly get 'x-served-by': 'cache-lhr6337-LHR',
26 silly get 'x-cache': 'HIT',
26 silly get 'x-cache-hits': '204',
26 silly get 'x-timer': 'S1475657938.353556,VS0,VE0',
26 silly get vary: 'Accept-Encoding' } ]
27 verbose etag https://registry.npmjs.org/reflect-metadata from cache
28 verbose get saving reflect-metadata to C:\Users\UZAIR\AppData\Roaming\npm-cache\registry.npmjs.org\reflect-metadata.cache.json
29 verbose correctMkdir C:\Users\UZAIR\AppData\Roaming\npm-cache correctMkdir not in flight; initializing
30 silly addNameTag next cb for reflect-metadata with tag latest
31 silly addNamed [email protected]
32 verbose addNamed "0.1.8" is a plain semver version for reflect-metadata
33 silly cache afterAdd [email protected]
34 verbose afterAdd C:\Users\UZAIR\AppData\Roaming\npm-cache\reflect-metadata\0.1.8\package\package.json not in flight; writing
35 verbose correctMkdir C:\Users\UZAIR\AppData\Roaming\npm-cache correctMkdir not in flight; initializing
36 verbose afterAdd C:\Users\UZAIR\AppData\Roaming\npm-cache\reflect-metadata\0.1.8\package\package.json written
37 silly install resolved [ { name: 'reflect-metadata',
37 silly install resolved version: '0.1.8',
37 silly install resolved description: 'Polyfill for Metadata Reflection API',
37 silly install resolved main: 'Reflect.js',
37 silly install resolved typings: 'typings.d.ts',
37 silly install resolved typescript: { definition: 'Reflect.d.ts' },
37 silly install resolved scripts:
37 silly install resolved { prepublish: 'npm run test',
37 silly install resolved build: 'tsc',
37 silly install resolved 'build-test': 'tsc --project ./test/',
37 silly install resolved test: 'npm run build & npm run build-test & node ./temp/test/run.js' },
37 silly install resolved repository:
37 silly install resolved { type: 'git',
37 silly install resolved url: 'git+https://github.com/rbuckton/ReflectDecorators.git' },
37 silly install resolved keywords: [ 'decorator', 'metadata', 'javascript', 'reflect' ],
37 silly install resolved author:
37 silly install resolved { name: 'Ron Buckton',
37 silly install resolved email: '[email protected]',
37 silly install resolved url: 'http://github.com/rbuckton' },
37 silly install resolved licenses: [ [Object] ],
37 silly install resolved license: 'Apache-2.0',
37 silly install resolved bugs: { url: 'https://github.com/rbuckton/ReflectDecorators/issues' },
37 silly install resolved homepage: 'http://rbuckton.github.io/ReflectDecorators',
37 silly install resolved dependencies: {},
37 silly install resolved devDependencies: { typescript: '^1.7.5' },
37 silly install resolved gitHead: 'd737a908100aa8ca7f083f815f06875cb80a217e',
37 silly install resolved _id: '[email protected]',
37 silly install resolved _shasum: '72426d570b60776e3688968bd5ab9537a15cecf6',
37 silly install resolved _from: 'reflect-metadata@latest',
37 silly install resolved _npmVersion: '3.4.0',
37 silly install resolved _nodeVersion: '6.0.0',
37 silly install resolved _npmUser: { name: 'rbuckton', email: '[email protected]' },
37 silly install resolved dist:
37 silly install resolved { shasum: '72426d570b60776e3688968bd5ab9537a15cecf6',
37 silly install resolved tarball: 'https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.8.tgz' },
37 silly install resolved maintainers: [ [Object] ],
37 silly install resolved _npmOperationalInternal:
37 silly install resolved { host: 'packages-16-east.internal.npmjs.com',
37 silly install resolved tmp: 'tmp/reflect-metadata-0.1.8.tgz_1470784336772_0.628053993685171' },
37 silly install resolved directories: {},
37 silly install resolved _resolved: 'https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.8.tgz',
37 silly install resolved readme: 'ERROR: No README data found!' } ]
38 info install [email protected] into C:\Users\UZAIR\AppData\Roaming\npm
39 info installOne [email protected]
40 verbose installOne of reflect-metadata to C:\Users\UZAIR\AppData\Roaming\npm not in flight; installing
41 verbose correctMkdir C:\Users\UZAIR\AppData\Roaming\npm-cache_locks correctMkdir not in flight; initializing
42 verbose lock using C:\Users\UZAIR\AppData\Roaming\npm-cache_locks\reflect-metadata-8e361738d35d115d.lock for C:\Users\UZAIR\AppData\Roaming\npm\node_modules\reflect-metadata
43 silly install write writing reflect-metadata 0.1.8 to C:\Users\UZAIR\AppData\Roaming\npm\node_modules\reflect-metadata
44 verbose unbuild node_modules\reflect-metadata
45 silly gentlyRm C:\Users\UZAIR\AppData\Roaming\npm\node_modules\reflect-metadata is being purged from base C:\Users\UZAIR\AppData\Roaming\npm
46 verbose gentlyRm don't care about contents; nuking C:\Users\UZAIR\AppData\Roaming\npm\node_modules\reflect-metadata
47 verbose tar unpack C:\Users\UZAIR\AppData\Roaming\npm-cache\reflect-metadata\0.1.8\package.tgz
48 verbose tar unpacking to C:\Users\UZAIR\AppData\Roaming\npm\node_modules\reflect-metadata
49 silly gentlyRm C:\Users\UZAIR\AppData\Roaming\npm\node_modules\reflect-metadata is being purged
50 verbose gentlyRm don't care about contents; nuking C:\Users\UZAIR\AppData\Roaming\npm\node_modules\reflect-metadata
51 silly gunzTarPerm modes [ '777', '666' ]
52 silly gunzTarPerm extractEntry package.json
53 silly gunzTarPerm extractEntry .npmignore
54 silly gunzTarPerm extractEntry README.md
55 silly gunzTarPerm extractEntry LICENSE
56 silly gunzTarPerm extractEntry Reflect.js
57 silly gunzTarPerm extractEntry bower.json
58 silly gunzTarPerm extractEntry Reflect.js.map
59 silly gunzTarPerm extractEntry Reflect.ts
60 silly gunzTarPerm extractEntry CopyrightNotice.txt
61 silly gunzTarPerm extractEntry typings/node.d.ts
62 silly gunzTarPerm extractEntry Reflect.d.ts
63 silly gunzTarPerm extractEntry reflect-metadata.d.ts
64 silly gunzTarPerm extractEntry spec/biblio.json
65 silly gunzTarPerm extractEntry spec/css/elements.css
66 silly gunzTarPerm extractEntry spec/index-out.html
67 silly gunzTarPerm extractEntry spec/index.html
68 silly gunzTarPerm extractEntry spec/metadata.md
69 silly gunzTarPerm extractEntry spec/typescript-out.html
70 silly gunzTarPerm extractEntry spec/typescript.html
71 silly gunzTarPerm extractEntry temp/Reflect.js
72 silly gunzTarPerm extractEntry temp/Reflect.d.ts
73 silly gunzTarPerm extractEntry temp/Reflect.js.map
74 silly gunzTarPerm extractEntry temp/test/harness.js
75 silly gunzTarPerm extractEntry temp/test/run.js
76 silly gunzTarPerm extractEntry temp/test/spec.js
77 silly gunzTarPerm extractEntry temp/test/harness.d.ts
78 silly gunzTarPerm extractEntry temp/test/harness.js.map
79 silly gunzTarPerm extractEntry temp/test/reflect/reflect-metadata.js
80 silly gunzTarPerm extractEntry temp/test/reflect/reflect-deletemetadata.js
81 silly gunzTarPerm extractEntry temp/test/reflect/reflect-getmetadata.js
82 silly gunzTarPerm extractEntry temp/test/reflect/reflect-getmetadatakeys.js
83 silly gunzTarPerm extractEntry temp/test/reflect/reflect-definemetadata.js
84 silly gunzTarPerm extractEntry temp/test/reflect/reflect-getownmetadata.js
85 silly gunzTarPerm extractEntry temp/test/reflect/reflect-getownmetadatakeys.js
86 silly gunzTarPerm extractEntry temp/test/reflect/reflect-hasmetadata.js
87 silly gunzTarPerm extractEntry temp/test/reflect/reflect-hasownmetadata.js
88 silly gunzTarPerm extractEntry temp/test/reflect/reflect-decorate.js
89 silly gunzTarPerm extractEntry temp/test/reflect/reflect-getownmetadata.d.ts
90 silly gunzTarPerm extractEntry temp/test/reflect/reflect-getmetadata.js.map
91 silly gunzTarPerm extractEntry temp/test/reflect/reflect-getmetadatakeys.d.ts
92 silly gunzTarPerm extractEntry temp/test/reflect/reflect-decorate.d.ts
93 silly gunzTarPerm extractEntry temp/test/reflect/reflect-getmetadatakeys.js.map
94 silly gunzTarPerm extractEntry temp/test/reflect/reflect-definemetadata.js.map
95 silly gunzTarPerm extractEntry temp/test/reflect/reflect-deletemetadata.d.ts
96 silly gunzTarPerm extractEntry temp/test/reflect/reflect-getownmetadata.js.map
97 silly gunzTarPerm extractEntry temp/test/reflect/reflect-getownmetadatakeys.d.ts
98 silly gunzTarPerm extractEntry temp/test/reflect/reflect-decorate.js.map
99 silly gunzTarPerm extractEntry temp/test/reflect/reflect-getownmetadatakeys.js.map
100 silly gunzTarPerm extractEntry temp/test/reflect/reflect-hasmetadata.d.ts
101 silly gunzTarPerm extractEntry temp/test/reflect/reflect-deletemetadata.js.map
102 silly gunzTarPerm extractEntry temp/test/reflect/reflect-hasmetadata.js.map
103 silly gunzTarPerm extractEntry temp/test/reflect/reflect-hasownmetadata.d.ts
104 silly gunzTarPerm extractEntry temp/test/reflect/reflect-getmetadata.d.ts
105 silly gunzTarPerm extractEntry temp/test/reflect/reflect-hasownmetadata.js.map
106 silly gunzTarPerm extractEntry temp/test/reflect/reflect-metadata.d.ts
107 silly gunzTarPerm extractEntry temp/test/reflect/reflect-definemetadata.d.ts
108 silly gunzTarPerm extractEntry temp/test/reflect/reflect-metadata.js.map
109 silly gunzTarPerm extractEntry temp/test/run.d.ts
110 silly gunzTarPerm extractEntry temp/test/run.js.map
111 silly gunzTarPerm extractEntry temp/test/spec.d.ts
112 silly gunzTarPerm extractEntry temp/test/spec.js.map
113 silly gunzTarPerm extractEntry test/harness.ts
114 silly gunzTarPerm extractEntry test/reflect/reflect-decorate.ts
115 silly gunzTarPerm extractEntry test/reflect/reflect-definemetadata.ts
116 silly gunzTarPerm extractEntry test/reflect/reflect-deletemetadata.ts
117 silly gunzTarPerm extractEntry test/reflect/reflect-getmetadata.ts
118 silly gunzTarPerm extractEntry test/reflect/reflect-getmetadatakeys.ts
119 silly gunzTarPerm extractEntry test/reflect/reflect-getownmetadata.ts
120 silly gunzTarPerm extractEntry test/reflect/reflect-getownmetadatakeys.ts
121 silly gunzTarPerm extractEntry test/reflect/reflect-hasmetadata.ts
122 silly gunzTarPerm extractEntry test/reflect/reflect-hasownmetadata.ts
123 silly gunzTarPerm extractEntry test/reflect/reflect-metadata.ts
124 silly gunzTarPerm extractEntry test/run.ts
125 silly gunzTarPerm extractEntry test/spec.ts
126 silly gunzTarPerm extractEntry test/tsconfig.json
127 silly gunzTarPerm extractEntry tsconfig.json
128 silly gunzTarPerm extractEntry typings.d.ts
129 verbose write writing to C:\Users\UZAIR\AppData\Roaming\npm\node_modules\reflect-metadata\package.json
130 info preinstall [email protected]
131 verbose readDependencies loading dependencies from C:\Users\UZAIR\AppData\Roaming\npm\node_modules\reflect-metadata\package.json
132 verbose readDependencies loading dependencies from C:\Users\UZAIR\AppData\Roaming\npm\node_modules\reflect-metadata\package.json
133 silly install resolved []
134 verbose about to build C:\Users\UZAIR\AppData\Roaming\npm\node_modules\reflect-metadata
135 info build C:\Users\UZAIR\AppData\Roaming\npm\node_modules\reflect-metadata
136 info linkStuff [email protected]
137 silly linkStuff [email protected] has C:\Users\UZAIR\AppData\Roaming\npm\node_modules as its parent node_modules
138 silly linkStuff [email protected] is part of a global install
139 silly linkStuff [email protected] is installed into a global node_modules
140 silly linkStuff [email protected] is installed into the top-level global node_modules
141 verbose linkBins [email protected]
142 verbose linkMans [email protected]
143 verbose rebuildBundles [email protected]
144 info install [email protected]
145 info postinstall [email protected]
146 verbose unlock done using C:\Users\UZAIR\AppData\Roaming\npm-cache_locks\reflect-metadata-8e361738d35d115d.lock for C:\Users\UZAIR\AppData\Roaming\npm\node_modules\reflect-metadata
147 verbose validateInstall loading C:\Users\UZAIR\AppData\Roaming\npm\package.json for validation
148 verbose stack Error: The package [email protected] does not satisfy its siblings' peerDependencies requirements!
148 verbose stack at C:\Program Files\nodejs\node_modules\npm\lib\install.js:125:32
148 verbose stack at C:\Program Files\nodejs\node_modules\npm\lib\install.js:268:7
148 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-installed\read-installed.js:142:5
148 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-installed\read-installed.js:263:14
148 verbose stack at cb (C:\Program Files\nodejs\node_modules\npm\node_modules\slide\lib\async-map.js:47:24)
148 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-installed\read-installed.js:263:14
148 verbose stack at cb (C:\Program Files\nodejs\node_modules\npm\node_modules\slide\lib\async-map.js:47:24)
148 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-installed\read-installed.js:263:14
148 verbose stack at cb (C:\Program Files\nodejs\node_modules\npm\node_modules\slide\lib\async-map.js:47:24)
148 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-installed\read-installed.js:263:14
149 verbose cwd D:
150 error Windows_NT 10.0.14393
151 error argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "reflect-metadata"
152 error node v4.5.0
153 error npm v2.15.9
154 error code EPEERINVALID
155 error peerinvalid The package [email protected] does not satisfy its siblings' peerDependencies requirements!
155 error peerinvalid Peer [email protected] wants webpack@*
155 error peerinvalid Peer [email protected] wants webpack@^1.1.0 || ^2 || ^2.1.0-beta
155 error peerinvalid Peer [email protected] wants webpack@^1.12.6 || ^2.1.0-beta
155 error peerinvalid Peer [email protected] wants webpack@1 || 2 || ^2.0.0-beta || ^2.1.0-beta
155 error peerinvalid Peer [email protected] wants webpack@^2.1.0-beta
156 verbose exit [ 1, true ]

@AlBlanc
Copy link

AlBlanc commented Oct 5, 2016

Same here, with macOS Sierra.

npm version 3.10.8
node version 6.2.1

I can't even display ng --version but it should be [email protected]. I tried to update from [email protected] following the instruction (uninstall, clean npm cache, delete local modules dist and tmp folders ...)

@filipesilva
Copy link
Contributor

Dupe of #2431

@fahrradflucht
Copy link

same here but

➜  ~  npm -v
3.10.8

@MuhammadUzair
Copy link
Author

my issue is solved using update npm version 2 to 3 and update angular-cli globally.

@fahrradflucht
Copy link

Hm then I probably have to open a new one

@HNeukermans
Copy link

same here:
npm -v == 3.8.1

@ahsinsiddique
Copy link

how to solve this issue

@AlBlanc
Copy link

AlBlanc commented Oct 12, 2016

I installed the package globally and tadaaa it works! (Not sure this is the cleanest solution but it works)

Just type npm i -g reflect-metadata

@mymai91
Copy link

mymai91 commented Oct 14, 2016

I installed npm i -g reflect-metadata but issue still happening when I run
ng --version or ng new angular2_hello_world

I'm using npm version 3.10.7

Can you help solve it?

@juanfeorar
Copy link

same here, but:
npm -v == 3.10.8
node -v == 6.8.0

@darkj3an
Copy link

uninstalling and reinstalling works for me.. don't know why but it did :P

@juanfeorar
Copy link

Worked for me thanks .
these spets:

npm i -g reflect-metadata
npm uninstall -g angular-cli
npm cache clean 
npm install -g angular-cli

@fedexu
Copy link

fedexu commented Oct 23, 2016

I had the same error, i install globally for the command ng new myApp with the command
npm i -g reflect-metadata
npm i -g portfinder
and so the ng new myApp work, then for the ng serve or ng --version i run the command without the -g
npm i reflect-metadata
npm i portfinder
worked for me

@Chris2011
Copy link

Chris2011 commented Oct 26, 2016

The workaround worked after npm install -g reflect-metadata AND npm install -g portfinder for me, but this is still a workaround. This souldn't be done manually. It should be fixed soon.

@lianyi
Copy link

lianyi commented Nov 1, 2016

Another workaround works for me is to update npm to npm3
uninstall angular-cli first

npm un -g angular-cli

then

npm i npm@latest -g
npm i -g angular-cli

@Chris2011
Copy link

I had to install reflect-metadata and portfinder to the local project folder too after then everything worked.

@sondreb
Copy link

sondreb commented Nov 3, 2016

Had the same issue now after upgrading to beta 19-2, instructions from @juanfeorar worked just fine :-)

@KerimG
Copy link

KerimG commented Nov 8, 2016

Same issue with npm 3.10.8.

I tried installing reflect-metadata and portfinder and then re-installing angular-cli, however I still get this:

Cannot find module 'reflect-metadata' Error: Cannot find module 'reflect-metadata'

This will probably never get fixed...

@afranzy
Copy link

afranzy commented Nov 9, 2016

Thanks juanfeorar. Your steps worked for me. Upgraded npm to 3.5.0 from 2.x. Then followed your steps
npm i -g reflect-metadata
npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli

@Alioshka
Copy link

this issue still reproduce,
to avoid it we have to use workaround with "npm i -g reflect-metadata"
so ... the question why this issue are closed ?

@yasirunilan
Copy link

This worked for me.
First remove existing angular cli.
npm uninstall -g angular-cli
then install angular-cli again globally

npm install -g angular-cli
then install
npm install -g reflect-metadata
npm install -g portfinder

now it works

@invious
Copy link

invious commented Dec 16, 2016

So even after I do npm install -g reflect-metadata and the local version, it still gives me Cannot find module 'reflect-metadata'

Cannot find module 'reflect-metadata'
Error: Cannot find module 'reflect-metadata'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/angular-cli/node_modules/@ngtools/webpack/src/index.js:5:1)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/angular-cli/models/webpack-build-typescript.js:5:17)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/angular-cli/models/webpack-config.js:2:34)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/angular-cli/tasks/build-webpack.js:6:24)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/angular-cli/commands/build.js:3:23)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Class.includedCommands (/usr/local/lib/node_modules/angular-cli/addon/index.js:21:16)
    at /usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/lib/models/project.js:392:61
    at Array.forEach (native)
    at Project.addonCommands (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/lib/models/project.js:391:15)
    at Project.eachAddonCommand (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/lib/models/project.js:426:30)
    at module.exports (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/lib/cli/lookup-command.js:33:13)
    at CLI.<anonymous> (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/lib/cli/cli.js:34:26)
    at tryCatch (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:538:12)
    at invokeCallback (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:553:13)
    at publish (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:521:7)
    at flush (/usr/local/lib/node_modules/angular-cli/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)

I have node v6.9.1 and npm v3.10.8. I've done all the different workarounds on this thread, and none worked. Running OSX 10.12 (16A323)

@Chris2011
Copy link

@invious please go into the project dir and do a: npm i reflect-metadata w/o -g

@invious
Copy link

invious commented Dec 16, 2016

I did that as well, as it was mentioned in one of the comments. I am new to Angular2, and trying to run ng new angular2-todo-app so I'm not sure there is a project directory, per se since it hasn't generated anything yet. But I am in a directory and have tried both the global and local commands, cache cleaning and reinstalling and uninstalling and updating node and npm; I have tried everything in the comments above and can't generate a new project. Strangest is that a global install that seems to work is resulting in the same error. Tried all with sudo too

This is very annoying and preventing me from even beginning to learn Angular

ng new angular2-todo-app
npm install -g angular-cli
npm i -g reflect-metadata
npm uninstall -g angular-cli
 npm cache clean
npm install -g angular-cli
npm i -g reflect-metadata
npm i -g portfinder
ng new angular2-todo-app  # fails
npm i reflect-metadata
npm i portfinder
ng new angular2-todo-app  # fails
ng -v  # fails
npm i npm@latest -g
sudo npm install -g angular-cli
sudo npm i -g reflect-metadata

None of the posted solutions worked

EDIT: I ended up installing, reinstalling Node from the package on the website instead of Brew, but I can't be sure. In my frustration, I tried so many conflicting things that I am not sure what solved the issue for me. I think it was uninstalling Node via brew and reinstalling it via the installer and then force global installing Angular CLI

@mikila85
Copy link

+1

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests