Closed zjkipping closed 8 years ago
I can't reproduce this on Windows 10 myself. It looks like your install is missing a package, which can be the result of a broken install or of a NPM upgrade without reinstall.
This should work if that's the case, but you say you've tried it already:
npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli@webpack
I'll leave the issue open in case there's a way to repro this I can use to debug.
Same Problem here. uninstall and install not solveing this.
If i run any ng command outside a cli Project it works fine.
$ ng v angular-cli: 1.0.0-beta.11-webpack.2 node: 4.4.0 os: win32 x64
History: I build a app with cli yesterday. Everything works fine. Then I moved my files into a Project to push all to git. clone this Project and run: npm i npm install --save-dev angular-cli@webpack this throws error:
npm WARN optional Skipping failed optional dependency /chokidar/fsevents: npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14 npm WARN optional Skipping failed optional dependency /karma/chokidar/fsevents: npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14 npm WARN @angular/tsc-wrapped@0.2.2 requires a peer of typescript@^1.9.0-dev but none was installed. npm WARN tsickle@0.1.6 requires a peer of typescript@^1.8.0 || ^1.9.0-dev but none was installed. npm ERR! Windows_NT 10.0.10586 npm ERR! argv "C:\Program Files\nodejs\node.exe" "D:\Users\damu1de\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "--save-dev" "angular-cli@webpack" npm ERR! node v4.4.0 npm ERR! npm v3.8.7 npm ERR! path d:\workspace\DomainJumper\GUI\node_modules.staging\abbrev-7e384210 npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'd:\workspace\DomainJumper\GUI\node_modules.staging\abbrev-7e384210' -> 'd:\workspace\DomainJumper\GUI\node_modules\ember-cli\node_modules\npm\node_modules\abbrev' npm ERR! enoent ENOENT: no such file or directory, rename 'd:\workspace\DomainJumper\GUI\node_modules.staging\abbrev-7e384210' -> 'd:\workspace\DomainJumper\GUI\node_modules\ember-cli\node_modules\npm\node_modules\abbrev' npm ERR! enoent This is most likely not a problem with npm itself npm ERR! enoent and is related to npm not being able to find a file. npm ERR! enoent
npm ERR! Please include the following file with any support request: npm ERR! d:\workspace\DomainJumper\GUI\npm-debug.log
When i run: ng serve
module.js:327 throw err; ^
Error: Cannot find module 'semver'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.
hmmpf
package.json says:
"typescript": "^2.0.0"
Why????
I Change it to "typescript": "^1.8.10". Next try
ng version works now ng serve throws error:
ERROR in ./src/main.ts Module build failed: TypeError: this.ts.getAutomaticTypeDirectiveNames is not a function at State.loadTypesFromConfig (d:\workspace\DomainJumper\GUI\node_modules\awesome-typescript-loader\src\host.ts:148:36) at new State (d:\workspace\DomainJumper\GUI\node_modules\awesome-typescript-loader\src\host.ts:142:14) at Object.ensureInstance (d:\workspace\DomainJumper\GUI\node_modules\awesome-typescript-loader\src\instance.ts:150:19) at compiler (d:\workspace\DomainJumper\GUI\node_modules\awesome-typescript-loader\src\index.ts:37:20) at Object.loader (d:\workspace\DomainJumper\GUI\node_modules\awesome-typescript-loader\src\index.ts:18:18) @ multi main
ERROR in ./src/polyfills.ts Module build failed: TypeError: this.ts.getAutomaticTypeDirectiveNames is not a function at State.loadTypesFromConfig (d:\workspace\DomainJumper\GUI\node_modules\awesome-typescript-loader\src\host.ts:148:36) at new State (d:\workspace\DomainJumper\GUI\node_modules\awesome-typescript-loader\src\host.ts:142:14) at Object.ensureInstance (d:\workspace\DomainJumper\GUI\node_modules\awesome-typescript-loader\src\instance.ts:150:19) at compiler (d:\workspace\DomainJumper\GUI\node_modules\awesome-typescript-loader\src\index.ts:37:20) at Object.loader (d:\workspace\DomainJumper\GUI\node_modules\awesome-typescript-loader\src\index.ts:18:18)
run ng init ng serve works. PUH! hard work.
I am seeing the same or similar problem on mac. I have attached the npm debug file npm-debug.txt
I found (for me) followed solution: Just short my last post.
clone project npm i npm install --save-dev angular-cli@webpack ng init (no overwrite)
i find out that you need node v4.x to get it work, (had this problem with a team member)
regards
So I ended up taking a look at this again, since it would be preferable if I could get my desktop to run angular-cli vs my laptop.
I went ahead and uninstalled nodejs and wiped anything npm from appdata/roaming. Then installed the exact versions of Node.js (6.1.0) and npm (3.10.6) that my laptop has. Then attempting to install Angular-cli on the version of 1.0.0-beta.11-webpack.
I managed to watch the install closely this time and noticed some errors, that I haven't seen before on my laptop... Below are images of the errors
The first was an error then followed by a ton of warnings, that I have never noticed The second is a much larger error
Still ending up with the same 'portfinder' error when I attempt ANY ng commands, such as just typing ng by itself and hitting enter, ng init, ng new test_prog, ng -v, etc...
So I had this same issue during a project upgrade and resolved by going through a few hoops...
npm install
ng init
with no issues@bbohling Did something similar to what you suggested, as I don't even have a project created yet since I cannot run any commands. I went to where my angular-cli was installed globally, appdata/roaming/npm/node_modules, and ran npm install there. Unfortunately I still get the above npm install errors and the portfinder error outlined in the images of my previous comment...
Sorry @zjkipping I should have explicitly stated that I navigated not to the global angular-cli instance, but my local (project) instance.
I got the same problem and I solved the issue for me by going to my angular-cli folder and installing portfinder there with npm install portfinder
it's working now but not sure why I got the error. My colleagues have a very similar setup (mac, node 6.5.0, npm 3.10.6) and they didn't get this error.
I can reproduce this by wiping angular-cli or node modules and reinstalling
If a local npm install portfinder
fails to fix the issue, a global install of portfinder works.
Thank @retallicka and @jodytate for the very helpful answers. This seems to have done the trick for me. I can now run ng perfectly fine outside of another older angular-cli webpack project. I believe this problem is just that I am now on a newer version of the cli (beta.11-webpack.8) vs when I created it in the early days of beta.11-webpack.2. I'll go ahead and close this since my issues have been resolved.
Worked for me thanks 👍 cd your_project_folder Then : npm install --save-dev angular-cli@webpack ng init
@retallicka @jodytate followed both steps, but doesn't works on my MAC
@jodytate npm install portfinder solved the problem on my MAC.
Please install those dependence manually such as reflect-metadata and portfinder globally.
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.
I am currently using Windows 10 on this device, same as my laptop which doesn't seem to be having issues with the cli. I also have npm version 3.10.6 and nodejs version 6.4.0. I am running the command prompt in Administrator mode if that's makes a difference.
Regrettably like stated in the title I cannot run any angular-cli commands without the error, including "--version", but I did install angular-cli@webpack with npm. I also haven't started creating an app yet on this device due to this error.
Log from command prompt: (same error on everything command)
I have tried solutions from these: Angular2 : Need to create angular2 folder structure using latest angularCLI Webpack and Error: Cannot find module 'portfinder' with Webpack release and NPM 2 #1770 with no success and cannot seem to find anything else about this on google. Unlike the latter link, I do not care what version of npm I am using.