I tried downloading the Routing and Navigation example from this page
Here's the link to the specific zip.
I run the following sequence of commands:
- npm install
- npm install --save-dev @angular/cli@latest
- ng -v
- ng serve -o
From what I can make out Cannot read property 'config' of null is somehow related to a bad version of the CLI. But if I create a new project I can start it successfully with my existing setup
- ng new router
- cd router
- npm install
- ng serve -o
Old directory structure (from zip download) includes these files:
- bs-config.json
- e2e-spec.ts
New directory structure (from ng new):
- .angular-cli.json
- e2e is a folder with files inside
- karma.conf.js
- protractor.conf.js
- tsconfig.json
Is there some sort of ng upgrade command to convert a project?
There was some talk on Git about ng init, but that seems to now be a thing of the past.
I believe most of the files are related to end to end testing.
npm install npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated node-uuid@1.4.8: Use uuid module instead > phantomjs-prebuilt@2.1.14 install /opt/AngularProjects/router/node_modules/phantomjs-prebuilt > node install.js PhantomJS not found on PATH Download already available at /var/folders/xz/sgpc803n1ms6xpc5n571ytc80000gn/T/phantomjs/phantomjs-2.1.1-macosx.zip Verified checksum of previously downloaded file Extracting zip contents Removing /opt/AngularProjects/router/node_modules/phantomjs-prebuilt/lib/phantom Copying extracted folder /var/folders/xz/sgpc803n1ms6xpc5n571ytc80000gn/T/phantomjs/phantomjs-2.1.1-macosx.zip-extract-1498561599287/phantomjs-2.1.1-macosx -> /opt/AngularProjects/router/node_modules/phantomjs-prebuilt/lib/phantom Writing location.js file Done. Phantomjs binary available at /opt/AngularProjects/router/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs > fsevents@1.1.2 install /opt/AngularProjects/router/node_modules/fsevents > node install [fsevents] Success: "/opt/AngularProjects/router/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed Pass --update-binary to reinstall or --build-from-source to recompile npm notice created a lockfile as package-lock.json. You should commit this file. added 767 packages in 20.239s ng serve -o Unable to find "@angular/cli" in devDependencies. Please take the following steps to avoid issues: "npm install --save-dev @angular/cli@latest" You have to be inside an Angular CLI project in order to use the serve command. /opt/AngularProjects/router> npm install --save-dev @angular/cli@latest npm WARN prefer global node-gyp@3.6.2 should be installed with -g > node-sass@4.5.3 install /opt/AngularProjects/router/node_modules/node-sass > node scripts/install.js Cached binary found at /Users/jgf/.npm/node-sass/4.5.3/darwin-x64-57_binding.node > node-sass@4.5.3 postinstall /opt/AngularProjects/router/node_modules/node-sass > node scripts/build.js Binary found at /opt/AngularProjects/router/node_modules/node-sass/vendor/darwin-x64-57/binding.node Testing binary Binary is fine + @angular/cli@1.1.3 added 431 packages in 17.132s == ng -v _ _ ____ _ ___ / \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _| / △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | | / ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | | /_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___| |___/ @angular/cli: 1.1.3 node: 8.1.2 os: darwin x64 @angular/animations: 4.2.4 @angular/common: 4.2.4 @angular/compiler: 4.2.4 @angular/compiler-cli: 4.2.4 @angular/core: 4.2.4 @angular/forms: 4.2.4 @angular/http: 4.2.4 @angular/platform-browser: 4.2.4 @angular/platform-browser-dynamic: 4.2.4 @angular/platform-server: 4.2.4 @angular/router: 4.2.4 @angular/tsc-wrapped: 4.2.4 @angular/upgrade: 4.2.4 @angular/cli: 1.1.3 ng serve -o Cannot read property 'config' of null TypeError: Cannot read property 'config' of null at Class.run (/opt/AngularProjects/router/node_modules/@angular/cli/tasks/serve.js:22:63) at check_port_1.checkPort.then.port (/opt/AngularProjects/router/node_modules/@angular/cli/commands/serve.js:110:26) at at process._tickCallback (internal/process/next_tick.js:169:7)
In relation to the error in:
/opt/AngularProjects/router/node_modules/@angular/cli/tasks/serve.js
we have:
const config_1 = require("../models/config");
...
const projectConfig = config_1.CliConfig.fromProject().config;
I suspect this pertains to a missing .angular-cli.json file.
/opt/AngularProjects/router/node_modules/@angular/cli/models/config.d.ts
and
/opt/AngularProjects/router/node_modules/@angular/cli/models/config.js
refer to it.