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

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

Open CarreraPHP opened this issue 10 years ago • 20 comments

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

CarreraPHP avatar Jun 22 '16 22:06 CarreraPHP

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


CarreraPHP avatar Jun 23 '16 13:06 CarreraPHP

+1 to that issue

bobrosoft avatar Jun 23 '16 16:06 bobrosoft

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)

scastaldi avatar Jun 23 '16 21:06 scastaldi

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

Splaktar avatar Jun 26 '16 16:06 Splaktar

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)

Splaktar avatar Jun 26 '16 19:06 Splaktar

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

PatrickJS avatar Jun 26 '16 21:06 PatrickJS

@Splaktar can you update to 0.103.3

PatrickJS avatar Jun 26 '16 22:06 PatrickJS

@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!

Splaktar avatar Jun 26 '16 22:06 Splaktar

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

PatrickJS avatar Jun 26 '16 22:06 PatrickJS

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.

SwagMuffinMcYoloPants avatar Jun 27 '16 15:06 SwagMuffinMcYoloPants

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

PatrickJS avatar Jun 27 '16 15:06 PatrickJS

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.

SwagMuffinMcYoloPants avatar Jun 27 '16 17:06 SwagMuffinMcYoloPants

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

warnerpinz avatar Jul 01 '16 03:07 warnerpinz

Is This same issue as https://github.com/angular/angular-cli/issues/958

mackelito avatar Jul 05 '16 14:07 mackelito

It's related but not the same.

Splaktar avatar Jul 06 '16 11:07 Splaktar

Beta.9 and this issue still here.

BenevidesLecontes avatar Jul 09 '16 10:07 BenevidesLecontes

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

tagazok avatar Jul 09 '16 14:07 tagazok

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.

markjritchie avatar Jul 13 '16 08:07 markjritchie

Closed as issue was made obsolete by #1455.

filipesilva avatar Jul 28 '16 02: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.