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

ng new --mobile fails with peerDependencies not satisfied for angular2-universal

Open duergner opened this issue 10 years ago • 34 comments

MacOSX El Capitan

$ ng -v
angular-cli: 1.0.0-beta.5
node: 4.4.5
os: darwin x64

Very clean install, fresh OS, fresh Node (from pkg install)

$ ng new --mobile NAME
installing ng2
  create .clang-format
  create .editorconfig
  create src/app/NAME.component.spec.ts
  create src/app/NAME.component.ts
  create src/app/environment.ts
  create src/app/index.ts
  create src/app/shared/index.ts
  create src/favicon.ico
  create src/index.html
  create src/main.ts
  create src/system-config.ts
  create src/tsconfig.json
  create src/typings.d.ts
  create angular-cli-build.js
  create angular-cli.json
  create config/environment.dev.ts
  create config/environment.js
  create config/environment.prod.ts
  create config/karma-test-shim.js
  create config/karma.conf.js
  create config/protractor.conf.js
  create e2e/app.e2e.ts
  create e2e/app.po.ts
  create e2e/tsconfig.json
  create e2e/typings.d.ts
  create .gitignore
  create package.json
  create public/.npmignore
  create tslint.json
  create typings.json
installing mobile
  create src/icons/android-chrome-144x144.png
  create src/icons/android-chrome-192x192.png
  create src/icons/android-chrome-36x36.png
  create src/icons/android-chrome-48x48.png
  create src/icons/android-chrome-72x72.png
  create src/icons/android-chrome-96x96.png
  create src/icons/apple-touch-icon-114x114.png
  create src/icons/apple-touch-icon-120x120.png
  create src/icons/apple-touch-icon-144x144.png
  create src/icons/apple-touch-icon-152x152.png
  create src/icons/apple-touch-icon-180x180.png
  create src/icons/apple-touch-icon-57x57.png
  create src/icons/apple-touch-icon-60x60.png
  create src/icons/apple-touch-icon-72x72.png
  create src/icons/apple-touch-icon-76x76.png
  create src/icons/apple-touch-icon-precomposed.png
  create src/icons/apple-touch-icon.png
  create src/icons/favicon-16x16.png
  create src/icons/favicon-32x32.png
  create src/icons/favicon-96x96.png
  create src/icons/icon.png
  create src/icons/mstile-144x144.png
  create src/icons/mstile-150x150.png
  create src/icons/mstile-310x150.png
  create src/icons/mstile-310x310.png
  create src/icons/mstile-70x70.png
  create src/icons/safari-pinned-tab.svg
  create src/main-app-shell.ts
  create src/manifest.webapp
  create src/system-import.js
Successfully initialized git.
⠇ Installing packages for tooling via npm
├── es6-shim (ambient)
├── node (ambient)
├── angular-protractor (ambient dev)
├── jasmine (ambient dev)
└── selenium-webdriver (ambient dev)

The package [email protected] does not satisfy its siblings' peerDependencies requirements!
Error: The package [email protected] does not satisfy its siblings' peerDependencies requirements!
    at /usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/npm/lib/install.js:125:32
    at /usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/npm/lib/install.js:268:7
    at /usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/npm/node_modules/read-installed/read-installed.js:142:5
    at /usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/npm/node_modules/read-installed/read-installed.js:263:14
    at cb (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/npm/node_modules/slide/lib/async-map.js:47:24)
    at /usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/npm/node_modules/read-installed/read-installed.js:263:14
    at cb (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/npm/node_modules/slide/lib/async-map.js:47:24)
    at /usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/npm/node_modules/read-installed/read-installed.js:263:14
    at cb (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/npm/node_modules/slide/lib/async-map.js:47:24)
    at /usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/npm/node_modules/read-installed/read-installed.js:263:14

duergner avatar May 30 '16 07:05 duergner

I found a workaround for this in stack overflow, and worked well for me.

MauroJr avatar Jun 20 '16 20:06 MauroJr

@MauroJr thanks!

ghost avatar Jun 20 '16 21:06 ghost

Tried the solution and at first it seems to work.. But when changing "app.component.html" in any way I get this error:

Build error

The Broccoli Plugin: [AppShellPlugin] failed with: Error: There can be only one platform. Destroy the previous one to create a new one. at new BaseException (/Users/markus/projects/baby/client/node_modules/@angular/core/src/facade/exceptions.js:17:23) at Object.createPlatform (/Users/markus/projects/baby/client/node_modules/@angular/core/src/application_ref.js:36:15) at Bootloader.platform (/Users/markus/projects/baby/client/node_modules/angular2-universal/dist/node/bootloader.js:48:23) at new Bootloader (/Users/markus/projects/baby/client/node_modules/angular2-universal/dist/node/bootloader.js:16:33) at Function.Bootloader.create (/Users/markus/projects/baby/client/node_modules/angular2-universal/dist/node/bootloader.js:23:16) at AppShellPlugin.build (/Users/markus/projects/baby/client/node_modules/angular2-broccoli-prerender/dist/prerender.js:26:58) at /Users/markus/projects/baby/client/node_modules/broccoli-caching-writer/index.js:152:21 at lib$rsvp$$internal$$tryCatch (/Users/markus/projects/baby/client/node_modules/rsvp/dist/rsvp.js:1036:16) at lib$rsvp$$internal$$invokeCallback (/Users/markus/projects/baby/client/node_modules/rsvp/dist/rsvp.js:1048:17) at lib$rsvp$$internal$$publish (/Users/markus/projects/baby/client/node_modules/rsvp/dist/rsvp.js:1019:11) at lib$rsvp$asap$$flush (/Users/markus/projects/baby/client/node_modules/rsvp/dist/rsvp.js:1198:9) at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9)

The broccoli plugin was instantiated at: at AppShellPlugin.Plugin (/Users/markus/projects/baby/client/node_modules/broccoli-plugin/index.js:10:31) at AppShellPlugin.CachingWriter as constructor at new AppShellPlugin (/Users/markus/projects/baby/client/node_modules/angular2-broccoli-prerender/dist/prerender.js:15:16) at Angular2App._buildTree (/Users/markus/projects/baby/client/node_modules/angular-cli/lib/broccoli/angular2-app.js:153:48) at new Angular2App (/Users/markus/projects/baby/client/node_modules/angular-cli/lib/broccoli/angular2-app.js:53:23) at module.exports (/Users/markus/projects/baby/client/angular-cli-build.js:10:10) at Class.module.exports.Task.extend.setupBroccoliBuilder (/Users/markus/projects/baby/client/node_modules/angular-cli/node_modules/ember-cli/lib/models/builder.js:55:19) at Class.module.exports.Task.extend.init (/Users/markus/projects/baby/client/node_modules/angular-cli/node_modules/ember-cli/lib/models/builder.js:89:10) at new Class (/Users/markus/projects/baby/client/node_modules/angular-cli/node_modules/core-object/core-object.js:18:12) at Class.module.exports.Task.extend.run (/Users/markus/projects/baby/client/node_modules/angular-cli/node_modules/ember-cli/lib/tasks/serve.js:15:19) at /Users/markus/projects/baby/client/node_modules/angular-cli/node_modules/ember-cli/lib/commands/serve.js:64:24 at lib$rsvp$$internal$$tryCatch (/Users/markus/projects/baby/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16) at lib$rsvp$$internal$$invokeCallback (/Users/markus/projects/baby/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17) at /Users/markus/projects/baby/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:331:11 at lib$rsvp$asap$$flush (/Users/markus/projects/baby/client/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9) at _combinedTickCallback (internal/process/next_tick.js:67:7)

mackelito avatar Jun 20 '16 21:06 mackelito

I also tested this solution right now, and can verify that ng new app-name --mobile and ng serve works.

I found that ng serve -prod produces some console errors, but still seems to work somewhat.

I don't think that this issue is fully solved by the solution in https://github.com/angular/angular-cli/issues/958#issuecomment-227258879, but it is greatly alleviated. I will put up a PR that implements it.

filipesilva avatar Jun 20 '16 21:06 filipesilva

@filipesilva if you edit "app.component.html" does http://localhost:4200 show the wanted result?

mackelito avatar Jun 20 '16 21:06 mackelito

@mackelito what change did you make?

filipesilva avatar Jun 20 '16 21:06 filipesilva

Well.. any kind of change breaks it hehe.. Even changing from `

{{title}}

` to `

{{title}}

`

Edit: Just opening and saving the file without changes breaks Broccoli

mackelito avatar Jun 20 '16 21:06 mackelito

@mackelito I tried changing something simple like the whitespaces or adding some text on app.component.html, and the build still worked (no build errors) - but the browser app is showing the old content. I think's cache busting or the service worker problem.

Changing app.component.ts works though.

This issue won't be closed anyway, the problem is still there, it's just alleviated.

filipesilva avatar Jun 20 '16 21:06 filipesilva

hmmm.. strange that I don´t get the same problem as you!.. oh well.. I guess I´ll just have to wait :)

mackelito avatar Jun 20 '16 21:06 mackelito

Having same issue on mac + node 6 + last angular-cli. workaround does not work. the only way to use it now without --mobile option.

ZloiBubr avatar Jun 22 '16 19:06 ZloiBubr

@filipesilva I fixed The peerDependencies issue w Universal PR https://github.com/angular/universal/pull/449, but still trying to look into what's causing nothing to render.

MarkPieszak avatar Jun 23 '16 03:06 MarkPieszak

can confirm the problem

angular-cli: 1.0.0-beta.6 node: 6.0.0 os: darwin x64

updating the angular universal version to latest 0.101.9 makes it npm installable. however running ng serve ends in an ton of errors in console and only show undefined in the browser.

manuelfink avatar Jun 23 '16 14:06 manuelfink

Issue made obsolete by #1455. In addition to normal upgrade steps for webpack, I'd like to add that main-app-shell.ts was changed a LOT. Full control of dependencies was also passed onto the generated project so you should be able to update them yourself for whatever is needed.

See https://github.com/angular/angular-cli/blob/master/addon/ng2/blueprints/mobile/files/path/main-app-shell.ts for an example. The important bit is the getBootloader() and serialize functions, those are all the build system picks up.

I should add a comment there to explain it tbh... Also see https://github.com/angular/universal/pull/464.

Let me know if you're still experiencing problems on the upcoming webpack release.

filipesilva avatar Jul 27 '16 16:07 filipesilva

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.