Windows 7
ng --version. If there's nothing outputted, please runnode --version and paste the result here:angular-cli: 1.0.0-beta.11-webpack.2
node: 6.2.2
npm: 2.15.6
npm i -g [email protected]
ng
Error while running script "C:\Program Files (x86)\nodejs\node_modules\angular-cli\addon\ng2\commands\serve.ts":
Error: Cannot find module 'portfinder'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\angular-cli\addon\ng2\commands\serve.ts:6:18)
at Module._compile (module.js:541:32)
at Object.require.extensions..ts (C:\Program Files (x86)\nodejs\node_modules\angular-cli\lib\cli\index.js:29:14)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Class.module.exports.includedCommands (C:\Program Files (x86)\nodejs\node_modules\angular-cli\addon\ng2\index.js:16:16)
at C:\Program Files (x86)\nodejs\node_modules\angular-cli\node_modules\angular-cli\lib\models\project.js:392:61
at Array.forEach (native)
at Project.addonCommands (C:\Program Files (x86)\nodejs\node_modules\angular-cli\node_modules\angular-cli\lib\models\project.js:391:15)
at Project.eachAddonCommand (C:\Program Files (x86)\nodejs\node_modules\angular-cli\node_modules\angular-cli\lib\models\project.js:426:30)
at module.exports (C:\Program Files (x86)\nodejs\node_modules\angular-cli\node_modules\angular-cli\lib\cli\lookup-command.js:33:13)
at CLI.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\angular-cli\node_modules\angular-cli\lib\cli\cli.js:34:26)
at lib$rsvp$$internal$$tryCatch (C:\Program Files (x86)\nodejs\node_modules\angular-cli\node_modules\angular-cli\node_modules\rsvp\dist\rsvp.js:1036:16)
at lib$rsvp$$internal$$invokeCallback (C:\Program Files (x86)\nodejs\node_modules\angular-cli\node_modules\angular-cli\node_modules\rsvp\dist\rsvp.js:1048:17)
at lib$rsvp$$internal$$publish (C:\Program Files (x86)\nodejs\node_modules\angular-cli\node_modules\angular-cli\node_modules\rsvp\dist\rsvp.js:1019:11)
Cannot find module 'portfinder'
Error: Cannot find module 'portfinder'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\angular-cli\addon\ng2\commands\serve.ts:6:18)
at Module._compile (module.js:541:32)
at Object.require.extensions..ts (C:\Program Files (x86)\nodejs\node_modules\angular-cli\lib\cli\index.js:29:14)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Class.module.exports.includedCommands (C:\Program Files (x86)\nodejs\node_modules\angular-cli\addon\ng2\index.js:16:16)
at C:\Program Files (x86)\nodejs\node_modules\angular-cli\node_modules\angular-cli\lib\models\project.js:392:61
at Array.forEach (native)
at Project.addonCommands (C:\Program Files (x86)\nodejs\node_modules\angular-cli\node_modules\angular-cli\lib\models\project.js:391:15)
at Project.eachAddonCommand (C:\Program Files (x86)\nodejs\node_modules\angular-cli\node_modules\angular-cli\lib\models\project.js:426:30)
at module.exports (C:\Program Files (x86)\nodejs\node_modules\angular-cli\node_modules\angular-cli\lib\cli\lookup-command.js:33:13)
at CLI.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\angular-cli\node_modules\angular-cli\lib\cli\cli.js:34:26)
at lib$rsvp$$internal$$tryCatch (C:\Program Files (x86)\nodejs\node_modules\angular-cli\node_modules\angular-cli\node_modules\rsvp\dist\rsvp.js:1036:16)
at lib$rsvp$$internal$$invokeCallback (C:\Program Files (x86)\nodejs\node_modules\angular-cli\node_modules\angular-cli\node_modules\rsvp\dist\rsvp.js:1048:17)
at lib$rsvp$$internal$$publish (C:\Program Files (x86)\nodejs\node_modules\angular-cli\node_modules\angular-cli\node_modules\rsvp\dist\rsvp.js:1019:11)
The problem occurs with Webpack release and NPM 2. ember-cli depends on portfinder package and has it in node_modules after installation, but angular-cli expects portfinder to be located in its node_modules .
The problem can be solved by installing portfinder package manually in angular-cli or parent node_modules directory.
I had the same issue and needed to update npm.
npm install -g npm@latest
@cmjacques It upgrades NPM to 3. The issue applies to NPM 2.x which may be used on purpose.
NPM3 is needed, yes. https://github.com/angular/angular-cli/pull/1748 adds that requirement to the README.
@filipesilva But it works flawlessly with NPM 2 in other respects. Relying on portfinder in root node_modules while it is a dependency of child dependency (ember-cli) looks like a bug to me, which is concealed by NPM 3 directory structure.
Forcing NPM 3 for globally installed packages is the last thing the one may want, because it turns global node_modules into a big mess, it is impossible to say which packages were originally installed with -g.
I'm sorry but there is just no way around NPM3. It's a hard dependency, and it has nothing to do with ember-cli actually. You can always use npm list -g --depth=0 to see your global package list.
+1
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._
Most helpful comment
I had the same issue and needed to update npm.
npm install -g npm@latest