I have been trying to install the latest angular-cli in order to start a new project, but I've been encountering a very strange issue. When I run
npm install -g angular-cli@latest
angular-cli will seem to install successfully. However, when I actually try to use it or check the version with
ng --version
I get this error:
fs.js:640
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
TypeError: path must be a string or Buffer
at TypeError (native)
at Object.fs.openSync (fs.js:640:18)
at Object.fs.readFileSync (fs.js:508:33)
at Function.Version.fromProject (/Users/ryan/.nvm/versions/node/v6.7.0/lib/node_modules/angular-cli/upgrade/version.js:87:31)
at Function.Version.isPreWebpack (/Users/ryan/.nvm/versions/node/v6.7.0/lib/node_modules/angular-cli/upgrade/version.js:111:31)
at Function.Version.assertPostWebpackVersion (/Users/ryan/.nvm/versions/node/v6.7.0/lib/node_modules/angular-cli/upgrade/version.js:97:18)
at /Users/ryan/.nvm/versions/node/v6.7.0/lib/node_modules/angular-cli/bin/ng:25:15
at /Users/ryan/.nvm/versions/node/v6.7.0/lib/node_modules/angular-cli/node_modules/resolve/lib/async.js:44:21
at ondir (/Users/ryan/.nvm/versions/node/v6.7.0/lib/node_modules/angular-cli/node_modules/resolve/lib/async.js:187:31)
at /Users/ryan/.nvm/versions/node/v6.7.0/lib/node_modules/angular-cli/node_modules/resolve/lib/async.js:153:39
I have found lots of answers for similar errors, but they all seem to suggest that the issue was resolved in v1.0.0-beta.15, while I should have installed v1.0.0-beta.16. Regardless, when I follow the most popular suggestion I can find of commenting out line 25 of ng (Version.assertPostWebpackVersion();), I just get a different error:
→ ng --version
module.js:457
throw err;
^
Error: Cannot find module '../models/config'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/ryan/node_modules/angular-cli/packages/angular-cli/addon/index.js:4:16)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Function.Addon.lookup (/Users/ryan/node_modules/ember-cli/lib/models/addon.js:879:19)
at /Users/ryan/node_modules/ember-cli/lib/models/addons-factory.js:47:36
at visit (/Users/ryan/node_modules/ember-cli/lib/utilities/DAG.js:23:3)
at DAG.topsort (/Users/ryan/node_modules/ember-cli/lib/utilities/DAG.js:82:7)
at AddonsFactory.initializeAddons (/Users/ryan/node_modules/ember-cli/lib/models/addons-factory.js:44:9)
at Project.initializeAddons (/Users/ryan/node_modules/ember-cli/lib/models/project.js:374:36)
at Function.Project.nullProject (/Users/ryan/node_modules/ember-cli/lib/models/project.js:131:16)
at Function.Project.projectOrnullProject (/Users/ryan/node_modules/ember-cli/lib/models/project.js:640:22)
at module.exports (/Users/ryan/node_modules/ember-cli/lib/cli/index.js:94:25)
at module.exports (/Users/ryan/node_modules/angular-cli/packages/angular-cli/lib/cli/index.js:45:10)
at /Users/ryan/.nvm/versions/node/v6.7.0/lib/node_modules/angular-cli/bin/ng:36:5
at /Users/ryan/.nvm/versions/node/v6.7.0/lib/node_modules/angular-cli/node_modules/resolve/lib/async.js:44:21
at ondir (/Users/ryan/.nvm/versions/node/v6.7.0/lib/node_modules/angular-cli/node_modules/resolve/lib/async.js:187:31)
at /Users/ryan/.nvm/versions/node/v6.7.0/lib/node_modules/angular-cli/node_modules/resolve/lib/async.js:153:39
at onex (/Users/ryan/.nvm/versions/node/v6.7.0/lib/node_modules/angular-cli/node_modules/resolve/lib/async.js:93:22)
at /Users/ryan/.nvm/versions/node/v6.7.0/lib/node_modules/angular-cli/node_modules/resolve/lib/async.js:24:18
Thanks in advance for the help.
node: v6.7.0
npm: 3.10.3
os: osx El Capitan
EDIT: Additional information about my current setup, as requested by comments in answer submissions:
→ npm list -g typescript
/Users/ryan/.nvm/versions/node/v6.7.0/lib
└─┬ angular-cli@1.0.0-beta.16
├─┬ @angular-cli/ast-tools@1.0.2
│ └── typescript@2.0.0
├─┬ typedoc@0.4.5
│ └── typescript@1.8.10
└── typescript@2.0.2
→ npm list -g webpack
/Users/ryan/.nvm/versions/node/v6.7.0/lib
└─┬ angular-cli@1.0.0-beta.16
└── webpack@2.1.0-beta.22
→ npm list -g angular-cli
/Users/ryan/.nvm/versions/node/v6.7.0/lib
└── angular-cli@1.0.0-beta.16