4
votes

When I am trying to create new project by using the command, ng new project-name, I am getting error like below:

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 (/usr/lib/node_modules/angular-cli/upgrade/version.js:87:31) at Function.Version.isPreWebpack (/usr/lib/node_modules/angular-cli/upgrade/version.js:111:31) at Function.Version.assertPostWebpackVersion (/usr/lib/node_modules/angular-cli/upgrade/version.js:97:18) at /usr/lib/node_modules/angular-cli/bin/ng:25:15 at /usr/lib/node_modules/angular-cli/node_modules/resolve/lib/async.js:44:21 at ondir (/usr/lib/node_modules/angular-cli/node_modules/resolve/lib/async.js:187:31) at /usr/lib/node_modules/angular-cli/node_modules/resolve/lib/async.js:153:39

I suspect some issues while installing angular-cli but I am not sure. Any help would be helpful.

3
After so many trial and errors, It got resolved. :)Pradeepb
Could you share how it was resolved? I had a similar issueyasser
I wish there was exact solution but i did trial and error. sudo npm uninstall angular-cli -g sudo npm cache clean sudo apt-get remove nodejs restart the machine. then install nodejs(latest), then install angular-cliPradeepb
I have this problem, too. Tested on Ubuntu 14.04 and 16.04 with node v6.6.0 + npm 3.10.3. No solution found yet.sebge23
Then you can upvote the question. Some one can help you :) btw what is the issue for you? is it same? If so did you try what I have suggested in above comments?Pradeepb

3 Answers

2
votes

Had the same issue was able to fix it by doing the below:

  npm uninstall -g angular-cli
  npm cache clean
  npm install -g node-gyp
  npm install -g angular-cli

Then do ng --version to see if installed successfully.

2
votes

I was having the same issue, and this post was helpful: https://github.com/angular/angular-cli/issues/2135

It's maybe a little too hacky to really recommend as a solution, but this answer at least got me going:

Simplest workaround to continue working in your project is comment line 25 of node_modules/angular-cli/bin/ng : // Version.assertPostWebpackVersion(); Until it is fixed properly.

0
votes

Please try npm install -g webpack before npm install -g angular-cli