Angular-cli: ng new command with --mobile flag fails while without --mobile flag works fine.

Created on 23 Jun 2016  ยท  20Comments  ยท  Source: angular/angular-cli

OS:
Mac OSX El Capitan

NG Version:
angular-cli: 1.0.0-beta.6, node: 6.2.2, os: darwin x64

Reproduction step:
ng new project_name --mobile (the issue happens here, to see proper log need to do npm install inside the project folder)
cd project_name
npm install

log:


[email protected] /Users/yogeshofit/Desktop/angular2/workspace/Playbook-new-mobile4
โ”œโ”€โ”€ UNMET PEER DEPENDENCY @angular/[email protected]
โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ””โ”€โ”ฌ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ””โ”€โ”€ [email protected]
โ”œโ”€โ”ฌ UNMET PEER DEPENDENCY [email protected]
โ”‚ โ””โ”€โ”€ UNMET PEER DEPENDENCY angular2-universal@^0.102.0
โ””โ”€โ”ฌ [email protected]
โ””โ”€โ”ฌ [email protected]
โ””โ”€โ”ฌ [email protected]
โ””โ”€โ”ฌ [email protected]
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]
โ””โ”€โ”€ [email protected]

npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of angular2-universal@^0.102.0 but none was installed.
npm WARN [email protected] requires a peer of angular2-universal@^0.102.0 but none was installed.
npm WARN [email protected] requires a peer of angular2-universal@^0.102.0 but none was installed.
npm WARN [email protected] requires a peer of angular2-universal@^0.102.0 but none was installed.


Similar issue happened in Angular/QuickStart (https://github.com/angular/quickstart/issues/135)

Regards,
Yogesh Surendran alias CarreraPHP

2 (required) bufix

All 20 comments

After git pull. below is the error occurs during "npm start".

log:


p1 $npm start

[email protected] start /Users/yogeshofit/Desktop/angular2/workspace/p1
ng serve

(node:1755) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Cannot read property 'makeCurrent' of undefined
TypeError: Cannot read property 'makeCurrent' of undefined
at Object. (/Users/yogeshofit/Desktop/angular2/workspace/p1/node_modules/angular2-universal/dist/node/node.js:7:35)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
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 Object. (/Users/yogeshofit/Desktop/angular2/workspace/p1/node_modules/angular2-universal/dist/node/index.js:5:17)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
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)

npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.2.2
npm ERR! npm v3.9.5
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: ng serve
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'ng serve'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the p1 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ng serve
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs p1
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls p1
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/yogeshofit/Desktop/angular2/workspace/p1/npm-debug.log


+1 to that issue

similar error... running rc3 in windows... I ran it without --mobile and it worked

angular-cli: 1.0.0-beta.8
node: 6.2.2
os: win32 x64

ng serve

(node:7156) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please u
Cannot read property 'makeCurrent' of undefined
TypeError: Cannot read property 'makeCurrent' of undefined
at Object. (D:\Employee\employee-ui\node_modules\angu
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
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 Object. (D:\Employee\employee-ui\node_modules\angu
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
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)

I'm seeing this too with beta.8. Mobile seems to be completely broken.

This appears to be caused by using the old angular-universal 0.100.5 which was needed due to dependency issues. Those issues have been fixed in angular-universal 0.103.2.

Though using this new version of angular-universal leads to the following exception:

ng build
โ ธ BuildingDEPRECATION WARNING: `document` is no longer supported and will be removed in next release. Please use `template`
DEPRECATION WARNING: `Bootloader#serializeApplication` arguments has changed.Please use an `AppConfig` object {providers: Array<any>, directives: Array<any>, template: string}
EXCEPTION: Error in :0:0
ORIGINAL EXCEPTION: The selector "app-root" did not match any elements
ORIGINAL STACKTRACE:
Error: The selector "app-root" did not match any elements
    at new BaseException (/Users/splaktar/Git/tf/beta8App/node_modules/@angular/platform-browser/src/facade/exceptions.js:20:23)
    at NodeDomRenderer.DomRenderer.selectRootElement (/Users/splaktar/Git/tf/beta8App/node_modules/@angular/platform-browser/src/dom/dom_renderer.js:83:23)
    at DebugDomRenderer.selectRootElement (/Users/splaktar/Git/tf/beta8App/node_modules/@angular/core/src/debug/debug_renderer.js:19:39)
    at DebugAppView.AppView.selectOrCreateHostElement (/Users/splaktar/Git/tf/beta8App/node_modules/@angular/core/src/linker/view.js:109:41)
    at DebugAppView._View_AppComponent_Host0.createInternal (AppComponent_Host.template.js:12:21)
    at DebugAppView.AppView.create (/Users/splaktar/Git/tf/beta8App/node_modules/@angular/core/src/linker/view.js:87:21)
    at DebugAppView.create (/Users/splaktar/Git/tf/beta8App/node_modules/@angular/core/src/linker/view.js:299:44)
    at ComponentFactory.create (/Users/splaktar/Git/tf/beta8App/node_modules/@angular/core/src/linker/component_factory.js:147:36)

oh I found the problem. the angular2-broccoli-prerender plugin is using the old api that used document rather than template. I can add support for document again and release a patch

@Splaktar can you update to 0.103.3

@gdi2290 OK, it's working now! Thanks.

Here's the output:

ng build
โ ธ BuildingDEPRECATION WARNING: `document` is no longer supported and will be removed in next release. Please use `template`
DEPRECATION WARNING: `Bootloader#serializeApplication` arguments has changed.Please use an `AppConfig` interface {providers: Array<any>, directives: Array<any>, template?: string}
Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.
Built project successfully. Stored in "dist/".

Verified that I'm also able to ng serve it and that it loads properly.

Looks like the fix for this issue is to upgrade angular-cli to angular-universal 0.103.3!

kool, angular2-broccoli-prerender just needs to be updated now

Have you guys tried use the -prod flag? It doesn't seem to be working for me.
I'm using El Capitan and ng --version returns

angular-cli: 1.0.0-beta.8
node: 6.2.0
os: darwin x64

I used the following procedure.

ng new hello-mobile --mobile
npm i -D exists-sync
npm i -D object-assign
npm i -D minimatch
npm i -D walk-sync
npm i -D through
npm install angular2-universal@ 0.103.3 --save
npm install @angular/router-deprecated --save
ng serve -prod

I get an error saying

fs.js:95
throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs
^

Error: ENOTEMPTY: directory not empty, rmdir '/Users/lcorcuera/Documents/workspace/hello-mobile/dist/vendor/@angular/platform-server/node_modules/parse5'
at Error (native)

Also if I change [email protected] to latest, the same error occurs.

you also need to include parse5 ^1.5.0 and @angular/platform-server

Thanks. I tried that and it didn't work still. I noticed that when I did try that, it kept bringing up different dependencies. Out of curiosity, I decided to delete the dist directory and everything worked. I must've tried to do "ng serve" before doing "ng serve -prod". I tried making a new project and it seems to not like when you switch from doing "ng serve" to "ng serve -prod" which is why it keeps saying that folders aren't empty. Weird issue but at least I can finally have the production bundle! Thanks for all the help.

What should be the version to use for devDependency "angular2-broccoli-prerender" ?
I tried changing the version to 0.103.3, but I still get the same error. THanks

It's related but not the same.

Beta.9 and this issue still here.

I confirm. I also still have the "Cannot read property 'makeCurrent' of undefined" on beta.9 :(

I have the same problem too. I know that we're in Beta ere but it would be good if at least

ng new foo
ng new foo --mobile

were tested before each release.

Closed as issue was made obsolete by #1455.

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

Related issues

rajjejosefsson picture rajjejosefsson  ยท  3Comments

gotschmarcel picture gotschmarcel  ยท  3Comments

daBishMan picture daBishMan  ยท  3Comments

hartjo picture hartjo  ยท  3Comments

ericel picture ericel  ยท  3Comments