2

Using Angular2, after moving in the project folder, I get in this error while trying create a new component via CLI, I'm going to post all terminal messages:

edoardocanti$ ng generate component other
Could not start watchman; falling back to NodeWatcher for file system          
events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
installing component
create src/app/other/other.component.css
create src/app/other/other.component.html
create src/app/other/other.component.spec.ts
create src/app/other/other.component.ts
Cannot read property 'read' of undefined
TypeError: Cannot read property 'read' of undefined
at InsertChange.apply (/Users/edoardocanti/first-     
app/node_modules/@angular-cli/ast-tools/src/change.js:96:20)
at /Users/edoardocanti/first-app/node_modules/@angular-cli/ast-  
tools/src/change.js:71:61
at process._tickCallback (internal/process/next_tick.js:103:7) 

It creates the folder of my new component but I have to add manually it in the app.module.ts, but however it works.

The real problem is when I try to create a new component inside an existing folder, in this case Angular doesn't create any new component.

1
  • I have been bitten by this as well, yet the same version of angular-cli works fine for another of my projects, created a few days ago Commented Sep 30, 2016 at 10:51

2 Answers 2

2

Are you on 1.0.0.beta15 of angular-cli? If so, npm install -g angular-cli@latest. The problem seems to be gone in beta16

Sign up to request clarification or add additional context in comments.

Comments

1

make sure you cd into the app folder (just in case, from your sample it didn't seem), if not, try...

Check the version and make sure you are on latest:

ng -v
angular-cli: 1.0.0-beta.16
node: 6.2.0
os: darwin x64

Remove old and install new:

npm uninstall -g angular-cli
npm remove cache
npm install -g angular-cli@latest

if you have an existing project: may also need to remove node_modules look everywhere for beta.15 and replace with beta.16

change angular-cli.json: "version": "1.0.0-beta.16", package.json: "devDependencies": { "angular-cli": "1.0.0-beta.16",

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.