Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng fails on Version.assertPostWebpackVersion() on 1.0.0-beta.14 #2135

Closed
andrevmatos opened this issue Sep 15, 2016 · 32 comments
Closed

ng fails on Version.assertPostWebpackVersion() on 1.0.0-beta.14 #2135

andrevmatos opened this issue Sep 15, 2016 · 32 comments
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix

Comments

@andrevmatos
Copy link

  1. OS?
    Arch Linux with latest kernel and Node 6.5.0 through NVM
  2. Versions:
    angular-cli: 1.0.0-beta.14
    node: 6.5.0
    os: linux x64
  3. Repro steps.
    Local installation, empty folder:
    npm i angular-cli
    ./node_modules/.bin/ng init # fails
  4. The log given by the failure.
    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 (/sec/Dev/Link/scripts/web_files_py/flask_ged/ng/node_modules/angular-cli/upgrade/version.js:87:31)
at Function.Version.isPreWebpack (/sec/Dev/Link/scripts/web_files_py/flask_ged/ng/node_modules/angular-cli/upgrade/version.js:111:31)
at Function.Version.assertPostWebpackVersion (/sec/Dev/Link/scripts/web_files_py/flask_ged/ng/node_modules/angular-cli/upgrade/version.js:97:18)
at /sec/Dev/Link/scripts/web_files_py/flask_ged/ng/node_modules/angular-cli/bin/ng:25:15
at /sec/Dev/Link/scripts/web_files_py/flask_ged/ng/node_modules/resolve/lib/async.js:44:21
at ondir (/sec/Dev/Link/scripts/web_files_py/flask_ged/ng/node_modules/resolve/lib/async.js:187:31)
at /sec/Dev/Link/scripts/web_files_py/flask_ged/ng/node_modules/resolve/lib/async.js:153:3

  1. Mention any other details that might be useful.
    Commenting out the line 25 on angular-cli/bin/ng makes everything work again.
    This with the check Version.assertPostWebpackVersion(), was added on commit 21003b1 .
@BenoitFroment
Copy link

Same with both Windows 7 and Windows 8.1
node version : 6.5
npm version : 3.10.3

Steps :

npm install -g angular-cli@latest
go in work directory
npm install angular-cli@latest
ng new

@sterlingfs
Copy link

same on macOS

@alexverdaguer
Copy link

same here on Mac OS sierra with node 6.5.0

@iuliust
Copy link

iuliust commented Sep 16, 2016

same on Linux Mint with node 6.5

@Mattee
Copy link

Mattee commented Sep 16, 2016

Same here on Mac OSX Yosemite and Windows 10 with node 6.5.0.

@BenoitFroment
Copy link

any news or trick about this?

@hopefullToo
Copy link

hopefullToo commented Sep 16, 2016

Same on OS X El Capitan
node v6.6.0
npm 3.10.7

Installed latest version (*-beta.14)
tried ng --help
same error:

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

@andrevmatos
Copy link
Author

@Aorewen 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.

@hopefullToo
Copy link

hopefullToo commented Sep 16, 2016

I just commented out line 25 on angular-cli/bin/ng .
but now ng hangs if I call ng --help
a new line is displayed and I can enter any text but n nothing happens.
I quit the call with ^C.

I do not know if this has to do anything with this nam error message I got after installing angular-cli:

peer dep missing: webpack@1.x.x || 2.x.x, required by string-replace-loader@1.0.3

In the meanwhile I installed web pack:
npm ls webpack -g
/usr/local/lib
└── webpack@1.13.2

But I still get this error:
npm ls angular-cli
angular-cli@1.0.0-beta.14 /usr/local/lib/node_modules/angular-cli
└── UNMET PEER DEPENDENCY webpack@2.1.0-beta.22

Installed web pack@2.1.0-beta.22 but now I get the "old" message:
npm ls angular-cli
....
npm ERR! peer dep missing: webpack@1.x.x || 2.x.x, required by string-replace-loader@1.0.3

@alexverdaguer
Copy link

Updated node to v6.6.0 and now it works !

@ValeryVS
Copy link
Contributor

I fix this for node 6.5.0 with #2178

@JelF
Copy link

JelF commented Sep 20, 2016

Persisted in v6.6.0 for me

➜  angular nvm exec 6.6.0 ng 
Running node v6.6.0 (npm v3.10.7)
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 (/home/jelf/.nvm/versions/node/v6.6.0/lib/node_modules/angular-cli/upgrade/version.js:87:31)
    at Function.Version.isPreWebpack (/home/jelf/.nvm/versions/node/v6.6.0/lib/node_modules/angular-cli/upgrade/version.js:111:31)
    at Function.Version.assertPostWebpackVersion (/home/jelf/.nvm/versions/node/v6.6.0/lib/node_modules/angular-cli/upgrade/version.js:97:18)
    at /home/jelf/.nvm/versions/node/v6.6.0/lib/node_modules/angular-cli/bin/ng:25:15
    at /home/jelf/.nvm/versions/node/v6.6.0/lib/node_modules/angular-cli/node_modules/resolve/lib/async.js:44:21
    at ondir (/home/jelf/.nvm/versions/node/v6.6.0/lib/node_modules/angular-cli/node_modules/resolve/lib/async.js:187:31)
    at /home/jelf/.nvm/versions/node/v6.6.0/lib/node_modules/angular-cli/node_modules/resolve/lib/async.js:153:39

OS gentoo linux, angular-cli@1.0.0-beta.15

@mikedsharp
Copy link

Same issue for me on node 6.6.0, windows 10, I just get the upgrade warning and I'm asking for the latest version of angular-cli, I've done about 5 re-install cycles now.

@caseyhoward
Copy link

caseyhoward commented Sep 21, 2016

I'm on a linux machine and this happens in one directory but not in another. Weird.

Edit: The directory that worked was an existing project. The one that didn't work was an empty project (ng init hadn't been ran). I didn't some investigation and it's looking for the angular-cli.json file. That file doesn't exist until you run "ng init". This seems like a bug. It's impossible to create new projects.

I'm not sure how this would ever work for new projects. The ng bin script checks looks for an angular-cli.json first thing and blows up when it doesn't find it.

@caseyhoward
Copy link

caseyhoward commented Sep 21, 2016

Upon further review, I think I see the error:

https://github.com/angular/angular-cli/blob/master/packages/angular-cli/upgrade/version.ts#L79

That line should either check if the file exists or be moved into the try block below (line 82). It's trying to read in angular-cli.json. I'm not sure that's the best fix, but I changed it locally and it works.

@JelF
Copy link

JelF commented Sep 21, 2016

@caseyhoward can you make a diff?

nevermind, solved by touch angular-cli.json

@ValeryVS
Copy link
Contributor

@caseyhoward
No need for more try..catch
There is fix, wait for merging
#2178
https://github.com/angular/angular-cli/pull/2178/files

Workaround: create blank angular-cli.json

@filipesilva
Copy link
Contributor

@hansl can you have a look?

@davemo88
Copy link

davemo88 commented Sep 22, 2016

+1

error on node 6.6.0, npm 3.10.3, osx 10.10.5

@nlovett
Copy link

nlovett commented Sep 25, 2016

+1

[imho] this should work:

$ mkdir noglobal
$ cd noglobal
$ npm init -f
$ npm i -D angular-cli@latest
$ ./node_modules/.bin/ng init

@tobiasfi
Copy link

+1 👍

Same error here.

Windows 10
Node 6.6.0
npm 3.10.2

@GabrielDumbrava
Copy link

Same with
Linux
node 6.7.0
npm 3.10.3
angular-cli 1.0.0-beta.16

@tobiasfi
Copy link

tobiasfi commented Sep 29, 2016

Strange strange strange:
I get the error in some directories and not in others!!!
e.G. d:/tmp fails but d:/test/tmp works.
I can not find out what distinquishes them, it does not appear to be the name or emptyness ... òO

UPDATE:
After deleting what was inside d:/tmp , it works there too.
Maybe it was emptyness or certain files in that folder or .git ?

@PhilippSoehnlein
Copy link

To me it looks like it's a thing about installing the CLI globally or not. It works for me, when I install it via npm install --global angular-cli, but doing it locally (npm install angular-cli) and calling it from my local node_modules-folder doesn't.

@tobiasfi
Copy link

I did install it globally and it did not work for me.

@jigfox
Copy link

jigfox commented Sep 29, 2016

Same here with macOS Sierra

node@6.6.0
npm@3.10.8
angular-cli@1.0.0-beta.16

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

@matt-erhart
Copy link

matt-erhart commented Sep 29, 2016

Same here. ng -v only worked with an angular-cli.json in the pwd.
angular-cli: 1.0.0-beta.16
node: 6.7.0 (and 6.6.0)
os: win32 x64

No other ng commands seem to be working. Everything was working fine before my vacation about a week ago. Not sure what changed, and why reinstalling everything didn't fix it.

@vadost
Copy link

vadost commented Oct 2, 2016

Same on ubuntu 14.04, node v6.7.0, npm 3.10.3. Please help!

@NilsHolger
Copy link

angular-cli: 1.0.0 beta.16
ng build --prod
deploy to firebase dist folder
it was a mess, CSS and JS missing
now cli is broken
always get message
c:\Dev\angular2showcase>ng --v
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 (C:\Users\Nils\AppData\Roaming\npm\node_modu
les\angular-cli\upgrade\version.js:87:31)
at Function.Version.isPreWebpack (C:\Users\Nils\AppData\Roaming\npm\node_mod
ules\angular-cli\upgrade\version.js:111:31)
at Function.Version.assertPostWebpackVersion (C:\Users\Nils\AppData\Roaming
npm\node_modules\angular-cli\upgrade\version.js:97:18)
at C:\Users\Nils\AppData\Roaming\npm\node_modules\angular-cli\bin\ng:25:15
at C:\Users\Nils\AppData\Roaming\npm\node_modules\angular-cli\node_modules\r
esolve\lib\async.js:44:21
at ondir (C:\Users\Nils\AppData\Roaming\npm\node_modules\angular-cli\node_mo
dules\resolve\lib\async.js:187:31)
at C:\Users\Nils\AppData\Roaming\npm\node_modules\angular-cli\node_modules\r
esolve\lib\async.js:153:39

@zackarychapple
Copy link
Contributor

I can confirm that this is happening on Mac when trying to bump from .15 to .16

Visit http://ember-cli.com/user-guide/#watchman for more info.
angular-cli: 1.0.0-beta.16
node: 6.3.1
os: darwin x64

Failing with this error.

Path must be a string. Received null
TypeError: Path must be a string. Received null
    at assertPath (path.js:7:11)
    at Object.resolve (path.js:1148:7)
    at Class.exports.default.Task.extend.run (/Users/zchapple/code/wfa_ng2/node_modules/angular-cli/tasks/build-webpack-watch.js:14:26)
    at Class.Command.extend.run (/Users/zchapple/code/wfa_ng2/node_modules/angular-cli/commands/build.js:50:26)
    at Class.<anonymous> (/Users/zchapple/code/wfa_ng2/node_modules/angular-cli/lib/models/command.js:152:17)
    at tryCatch (/Users/zchapple/code/wfa_ng2/node_modules/rsvp/dist/lib/rsvp/-internal.js:215:12)
    at invokeCallback (/Users/zchapple/code/wfa_ng2/node_modules/rsvp/dist/lib/rsvp/-internal.js:230:13)
    at publish (/Users/zchapple/code/wfa_ng2/node_modules/rsvp/dist/lib/rsvp/-internal.js:198:7)
    at flush (/Users/zchapple/code/wfa_ng2/node_modules/rsvp/dist/lib/rsvp/asap.js:82:5)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

@filipesilva filipesilva added P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful needs: more info Reporter must clarify the issue and removed needs: more info Reporter must clarify the issue labels Oct 6, 2016
JJayet pushed a commit to JJayet/angular-cli that referenced this issue Oct 14, 2016
texel pushed a commit to splice/angular-cli that referenced this issue Nov 3, 2016
@datrinh
Copy link

datrinh commented Jan 13, 2017

Not sure if this is the same issue, but I'm getting this error:

Path must be a string. Received { source: 'environments/environment.ts',
  dev: 'environments/environment.ts',
  prod: 'environments/environment.prod.ts' }

Newly installed ng-cli with these version:

angular-cli: 1.0.0-beta.25.5
node: 6.7.0
os: darwin x64
@angular/common: 2.4.3
@angular/compiler: 2.4.3
@angular/core: 2.4.3
@angular/forms: 2.4.3
@angular/http: 2.4.3
@angular/material: 2.0.0-beta.1
@angular/platform-browser: 2.4.3
@angular/platform-browser-dynamic: 2.4.3
@angular/router: 3.4.3
@angular/compiler-cli: 2.4.3

Barely did any coding. Added 4 components and one service, also angular/material and now this error is thrown when I run ng serve

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix
Projects
None yet
Development

No branches or pull requests