Vue-cli: Last version of js-beautify breaks vue-cli installation

Created on 18 Sep 2017  路  13Comments  路  Source: vuejs/vue-cli

Steps to reproduce:

Run npm i -g vue-cli in terminal

Expected behavior:

vue-cli should install

Actual behavior:

The installation fails and this error is logged:

error path C:\Users\<my-user-folder>\AppData\Roaming\npm\node_modules\vue-cli\node_modules\js-beautify\js\bin\css-beautify.js
error code ENOENT
error errno -4058
error syscall chmod
error enoent ENOENT: no such file or directory, chmod 'C:\Users\<my-user-folder>\AppData\Roaming\npm\node_modules\vue-cli\node_modules\js-beautify\js\bin\css-beautify.js'
error enoent This is most likely not a problem with npm itself
error enoent and is related to npm not being able to find a file.

Notes:

An issue has already been opened in js-beautify repo:
https://github.com/beautify-web/js-beautify/issues/1247

Most helpful comment

For a quick fix, you can install yarn and run yarn global add vue-cli.

All 13 comments

For a quick fix, you can install yarn and run yarn global add vue-cli.

Seems this has to be solved in js-beautify. Good to know that yarn seems to work, though I wonder why.

@LinusBorg https://github.com/vuejs/vue-cli/blob/master/yarn.lock#L3192.
If we have a package-lock.json in this repo, npm would also work.

Edit: npm-shrinkwrap.json instead of package-lock.json here would make npm work.

@jddxf thanks, yarn works.

@jddxf I think an npm-shrinkwrap.json would be even better in this case: command line tools (such as vue-cli) are among the recommended use-cases mentioned in npm official documentation:

The recommended use-case for npm-shrinkwrap.json is applications deployed through the publishing process on the registry: for example, daemons and command-line tools intended as global installs or devDependencies.

@LucaBlackDragon You're right. I didn't realize the difference between package-lock.json and npm-shrinkwrap.json.

One key detail about package-lock.json is that it cannot be published, and it will be ignored if found in any place other than the toplevel package.

So having a package-lock.json would not make npm work here.

@LucaBlackDragon That's a good point, we should think about using that.

/cc @vuejs/collaborators do you have any thoughts on this one?

yarn not install with npm but with the msi in win10 can install the cli successfully

Vue-cli doesn't depend on js-beautify directly. But some dependency bumped its dependency on js-beautify and that breaks us.

I would give a thumb up for npm-shirnkwrap.json, which is designed for avoiding such scenario.

The recommended use-case for npm-shrinkwrap.json is applications deployed through the publishing process on the registry: for example, daemons and command-line tools intended as global installs or devDependencies.

https://docs.npmjs.com/files/shrinkwrap.json

@HerringtonDarkholme hmm lockfile actually wouldn't work for end users, I think you mean npm-shrinkwrap.json

@egoist Sure. Thanks for correction.

Pull request is up, just needs permission to merge: https://github.com/beautify-web/js-beautify/pull/1251

dup of #591

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Gonzalo2683 picture Gonzalo2683  路  3Comments

NathanKleekamp picture NathanKleekamp  路  3Comments

chasegiunta picture chasegiunta  路  3Comments

csakis picture csakis  路  3Comments

JIANGYUJING1995 picture JIANGYUJING1995  路  3Comments