I am filing a bug when I execute the command "ng build" since I been updated to version 0.0.27 (no worries in Version 0.0.26)
user@computer c:\dev\project\project_name
$ ng build
BuildingCannot read property 'push' of undefined
TypeError: Cannot read property 'push' of undefined
at addPathRecursive (c:\dev\project\project_name\node_modules\angular-cli\lib\broccoli\angular2-app.js:54:23)
at c:\dev\project\project_name\node_modules\angular-cli\lib\broccoli\angular2-app.js:58:11
at Array.forEach (native)
at addPathRecursive (c:\dev\project\project_name\node_modules\angular-cli\lib\broccoli\angular2-app.js:57:34)
at Array.forEach (native)
at Angular2App.toTree (c:\dev\project\project_name\node_modules\angular-cli\lib\broccoli\angular2-app.js:51:31)
at module.exports (c:\dev\project\project_name\angular-cli-build.js:13:16)
at Class.module.exports.Task.extend.setupBroccoliBuilder (c:\dev\project\project_name\node_modules\angular-cli\lib\models\builder.js:57:19)
at Class.module.exports.Task.extend.init (c:\dev\project\project_name\node_modules\angular-cli\lib\models\builder.js:91:10)
at new Class (c:\dev\project\project_name\node_modules\core-object\core-object.js:18:12)
My development environment :
angular-cli: 0.0.27
node: 5.1.0
os: win32 x64
npm: 3.8.3
If you want more information do not hesitate.
Thanks
On my CI server, same problem this morning:
└── [email protected]
Could not find watchman, falling back to NodeWatcher for file system events.
Visit http://www.ember-cli.com/user-guide/#watchman for more info.
BuildingCannot read property 'push' of undefined
TypeError: Cannot read property 'push' of undefined
at addPathRecursive (/workspace/node_modules/angular-cli/lib/broccoli/angular2-app.js:54:23)
at /workspace/node_modules/angular-cli/lib/broccoli/angular2-app.js:58:11
Please try creating ng new project with 0.0.27 or ng init inside existing project. It should work.
i have the same error by executing the command ng new project.
When I create a new project (ng new project) I get the same error. When I do ng init in that new project, and I accept to overwrite all files, it works.
However, when I do ng init on an existing project, it doesn't, the difference with the previous case being that now I don't overwrite any files (I have made changes to most of these files, so this is a no-go).
Also, what exactly is the purpose of ng init? Are we supposed to run this whenever there's a new version of angular cli?
ng init is just like ng new but in existing folder.
"Are we supposed to run this whenever there's a new version of angular cli?"
No, of course not, but we are working on the new (faster) build system and some of the latest versions might have issues.
I will test this later today on Windows and report it under this issue.
Ok ng init works for me. But I only override tsconfig.json. Here the diff:
+ },
+
+ "files": [
+ "app.ts",
+ "typings.d.ts"
+ ]
}
Try to rollback/upgrade your NPM to LTS and reinstall angular-cli
Hi, I had the same problem, I can't explain what is the problem but this is how I manage that. After upgrading npm packages there was the issue with "property push undefined", I googled it and read this post:
After midday this bug reappeared, in my case, it seems that my config file tsconfig.json has to include the "files" instruction.
In a nutshell:
{
"compileOnSave": false,
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"mapRoot": "",
"module": "system",
"moduleResolution": "node",
"noEmitOnError": true,
"noImplicitAny": false,
"outDir": "../dist/",
"rootDir": ".",
"sourceMap": true,
"sourceRoot": "/",
"target": "es5"
}
} is not working for me but
`{
"compileOnSave": false,
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"mapRoot": "",
"module": "system",
"moduleResolution": "node",
"noEmitOnError": true,
"noImplicitAny": false,
"outDir": "../dist/",
"rootDir": ".",
"sourceMap": true,
"sourceRoot": "/",
"target": "es5"
},
"files": [
"app.ts",
"typings.d.ts"
]
}`
worked but only fiels specified are compiled, it seems there is an error in the v0.0.27 because I've just reinstalled v0.0.26 and it works perfectly
Hi,
if you don't have Python in your system then try installing it.
I had the same issue when I have upgraded from angular-cli v0.0.25 ti v0.0.26.
ng init for some reason did not work for me so I had to check the files generated manually.
Here are the files that changed:
ember-cli-build.js:
/* global require, module */
var Angular2App = require('angular-cli/lib/broccoli/angular2-app');
module.exports = function(defaults) {
var app = new Angular2App(defaults, {
vendorNpmFiles: []
});
return app.toTree();
};
Only the ";" was added, but I will write all files that where changed.
package.json:
{
"name": "idmssystem",
"version": "0.0.1",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng server",
"postinstall": "typings install --ambient",
"lint": "tslint src/**/*.ts",
"format": "clang-format -i -style=file --glob=src/**/*.ts",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"angular2": "2.0.0-beta.11",
"es6-shim": "^0.35.0",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2",
"systemjs": "0.19.20",
"zone.js": "^0.6.4"
},
"devDependencies": {
"angular-cli": "0.0.*",
"angular-cli-github-pages": "^0.2.0",
"clang-format": "^1.0.35",
"ember-cli-inject-live-reload": "^1.3.0",
"jasmine-core": "^2.3.4",
"jasmine-spec-reporter": "^2.4.0",
"karma": "^0.13.15",
"karma-chrome-launcher": "^0.2.1",
"karma-jasmine": "^0.3.6",
"protractor": "^3.0.0",
"ts-node": "^0.5.5",
"tslint": "^3.6.0",
"typescript": "^1.8.7",
"typings": "^0.6.6"
}
}
-license changed from Apache-2.0 to MIT
-angular-cli changed
-angular2 changed to2.0.0-beta.11(i recommend use beta 12 since in 11 there is a problem with zone.js)
-clang-format was moved to devDependencies
-es6-promise was removed
-es6-shim was upgraded
-zonejs was upgraded to 0.6.4 (I recommend to use the 0.6.6)
-glob was added to devDependencies
-tsnode was updated
-tslint was updated
File protractor.conf.js:
var SpecReporter = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'e2e/**/*.e2e.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
useAllAngular2AppRoots: true,
beforeLaunch: function() {
require('ts-node').register({
project: 'e2e'
});
},
onPrepare: function() {
jasmine.getEnv().addReporter(new SpecReporter());
},
};
-beforeLaunch was changed
File e2e/tsconfig.json:
{
"compileOnSave": false,
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"mapRoot": "",
"module": "commonjs",
"moduleResolution": "node",
"noEmitOnError": true,
"noImplicitAny": false,
"rootDir": ".",
"sourceMap": true,
"sourceRoot": "/",
"target": "es5"
}
}
compileOnSave was added by default now
module changed from system to commonjs
File src/tsconfig.json:
was all ready discussed in comments.
What was added:
,
"files": [
"app.ts",
"typings.d.ts"
]
File tslint.json
Property "semicolon was changed from true to
"semicolon": [true, "always"],
and file e2e/typings.d.ts was added and contains:
/// <reference path="../typings/main.d.ts" />
Hope this will help you upgrade to the new angular-cli
Ugh.... yes this is a nasty side effect of the rapid iteration we're going through. In a nutshell, some CLI updates affect not only the CLI itself, but _also_ the generated files.
Which might or might not be fine for upgrading existing projects. If new CLI functionality depends on the modified generated files, then your project will basically... break.
At the moment we are mostly focused on getting main functionality in as fast as possible, so upgradeability is not yet a concern. It definitely is on the short list of functionality for a beta though.
For now the best tip I can give for upgraders is that, if you want to upgrade a project to the newest CLI, then generate a new project, copy over all the base auto-generated files and npm install. That'll mostly guarantee that you have the most up to date ng new files as possible. Other stuff might still break though... but only if we fundamentally change generators.
I'd like to say that we love you guys, the upgraders. You're the group most invested in using the CLI and giving feedback. Upgrading will get better!
I've had the same kind of error.
The problem comes from lib/broccoli/angular2-app.js assuming there is a files property in tsconfig. This is of course the case after ng new, but shouldn't be required, since it is valid.
In my case, I tried to remove the files entry in tsconfig.json (meaning "include every .ts files") because of typescript support in VSCode : files not explicitely listed in it would not be considered part of the project, and therefore intellisense wouldn't consider them (and the compiler options wouldn't be considered either, giving me an ugly squiggle about experimentalDecorators being needed).
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
ng initis just likeng newbut in existing folder."Are we supposed to run this whenever there's a new version of angular cli?"
No, of course not, but we are working on the new (faster) build system and some of the latest versions might have issues.
I will test this later today on Windows and report it under this issue.