js-beautify: Installing js-beautify fails

Description

I am trying to install a library, which is dependant on this one, and starting today (I’ve tried the last week the last time) I get the following error when installing my dependencies:

npm ERR! path /Users/daniel.rotter/Development/massiveart/sulu-minimal/vendor/sulu/sulu/node_modules/js-beautify/js/bin/css-beautify.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '/Users/daniel.rotter/Development/massiveart/sulu-minimal/vendor/sulu/sulu/node_modules/js-beautify/js/bin/css-beautify.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/daniel.rotter/.npm/_logs/2017-09-18T05_55_47_583Z-debug.log

It looks to me like this is somehow connected to the latest 1.7.0 release… Any ideas?

Steps to Reproduce

Create a new folder and install this library as dependency using npm install js-beautify.

Environment

OS: Mac OSX 10.11.6

Deleted most of the PR template, since it’s not relevant.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 288
  • Comments: 249 (4 by maintainers)

Commits related to this issue

Most upvoted comments

@IvanFan I am sure other libraries haven’t updated to this version yet. So just add the following line to your dependencies:

{
    "dependencies": {
        "js-beautify": "1.6.14"
    }
}

Mind the missing ^.

@IvanFan fucked is a little bit exaggerating IMO… Just use npm install js-beautify@1.6.14 for now, that will work until a fix is released.

This bug report is only just over 30 minutes old for an upload that is only 1 hour old. How about giving the poor developer a chance to fix it? Or even better, providing a pull request to fix it?

we are fucked…

we are fucked…

me 2 we are preparing the latest update and now we fucked…

It looks like somebody got a good story to tell when will be a grandpa: “That day when I screwed up the whole programming world”

Nice monday, guys 😄

Wish I could lock this thread, this is fucking ridiculous.

WE ARE AWARE OF THE ISSUE, STOP SPAMMING AND USE THE POSTED WORKAROUNDS.

Just go back and use react / angular already.

Just found this. vue-cli is breaking as a result.

We are using some third-party npm packages which are using js-beautify… Any idea how to force other dependencies to use the old version?

Someone please delete every instance of +1 and those rude comments in this thread. People seem to have no manners anymore …

{
    "dependencies": {
        "js-beautify": "1.6.14"
    }
}

Adding this into the dependencies solved the build in our CI, should be good for a temporary fix. Thanks @danrot

To install vue-cli: npm install -g js-beautify@1.6.14 vue-cli

I solved the problem this way: 1)rm -rf node_modules/ 2)npm install --save-dev js-beautify@1.6.14 3) add in package.json: “resolutions”: { “js-beautify”: “1.6.14” } 4)npm i

Can we please stop posting “+1”. It’s useless, doesn’t help the developer, and spam this issue with non-constructive comments. We’re developers, we hate useless bug tickets with no information, let’s NOT do the same things to fellow developers.

Stop the fucking “+1” without any information.

we are fucked…

js-beautify@1.7.0 breaks the project installation and trying to use the lower version 1.6.14 for solving this issue

we are fucked!!! i can’t work now.

@brianmay Finally somebody reasonable… It’s not like we all have to stop working now, the temporary fix is quite easy.

My guess would also be that this library is primarily maintained in the spare time of the contributors, and I don’t think that the attitude in this issue is very motivating… So I’d like to say thank you for the great work, and in advance for fixing this issue 😃

fuck me

I can’t install vue-cli itself 2

Step one. Convince boss we should use vue. Step two. This issue. edit: Ok, we should probably not use this as a chat… Sorry.

Im fuck today of this

fuck it im switching everything to perl

This issue made my day

js-horrorify.

We are fucking!

This worked for us:-

Create npm-shrinkwrap.json parallel to package.json

{ 
  "dependencies": 
   { 
     "js-beautify": 
     { 
        "version": "1.6.14"
      }
    } 
} 

This will work even if js-beautify is internally used in some other packages.

Please either un-publish the current version, or fix it ASAP…!

Temporary fix for vue-cli:

Do not install it globally but in a temp folder.

mkdir C:\vue_cli_temp
cd C:\vue_cli_temp
npm install js-beautify@1.6.14
npm install vue-cli

Then you can use the vue-cli installed like this:

C:\vue_cli_temp\node_modules\.bin\vue init simple MyVueProject

The problem is that I can’t install vue-cli itself…

npm install -g vue-cli --registry=https://registry.npm.taobao.org can resolve for now

we are fucked

I don’t have permissions to the repo anymore, but I still have ownership of the npm package. I just published v1.7.1 that contains all necessary files.

Please, stop spamming this thread. As soon as @bitwiseman is back on the grid, he can handle the PR and whatnot.

@evocateur People is having important issues because of this, at least let them express it, otherwise we won’t know how big the impact is.

When they find someone who has the permission to merge PR’s… https://github.com/beautify-web/js-beautify/pull/1251

@steven-qi comments solved my issue with vue-loader.

add this to package.json.

"resolutions": {
     "js-beautify": "1.6.14"
   }

+3 We are also facing the same issue

People, just add “js-beautify”: “1.6.14” under dependencies in your package.json. I had a problem with the vue pwa template but this solves it. Don’t panic 😉

rm -rf node_modules/ rm -rf yarn.lock add this to package.json

"resolutions": {
     "js-beautify": "1.6.14"
 }

yarn ok

Just the day I started with vue-cli xD

悲伤逆流成河

@IvanFan Doesn’t matter, if your project defines it without ^ it will install exactly this version. ^1.6.14 means >= 1.6.14 && < 2.0, so it “works” with every of these versions.

nothing works 🙄

can’t believe this issue has cost me 3 hours of my life 😡

you broke vue 😢

Workaround: create a shrinkwrap for your project and force dependency versions for affected packages (e.g. vue-loader for me).

Create a npm-shrinkwrap.json file alongside where your package.json lives, add the following:

{ 
  "dependencies": { 
    "vue-loader": { 
      "version": "^13.0.1", 
      "dependencies": { 
        "js-beautify": { 
          "version": "1.6.14" 
        } 
      } 
    } 
  } 
}

You may need to adjust version numbers, and if you have multiple dependencies relying on js-beautify you’ll have to list them all in there.

+1

npm: npm install --save-dev js-beautify@1.6.14 yarn: yarn add js-beautify@1.6.14 --dev

Add this to your package.json file:

  "resolutions": {
    "js-beautify": "1.6.14"
  }

npm install js-beautify@1.6.14 success.

npm install js-beautify@1.7.0 failed.

Important update for everyone that used these fixes in vuejs

Time to remove "js-beautify": "1.6.14" from your "dependencies":{} and "resolve":{} vue-loader@13.0.5 has been published, please update.

https://twitter.com/vuejs/status/909785891941617664

everybody panic

@niahmiah solution works, ty soo much i can finally work ! (‘npm install -g js-beautify@1.6.14 vue-cli’)

Install vue-cli with yarn then just replace js-beautify section in yarn.lock of your application with this: js-beautify@^1.6.3: version "1.6.14" resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.6.14.tgz#d3b8f7322d02b9277d58bd238264c327e58044cd" dependencies: config-chain "~1.1.5" editorconfig "^0.13.2" mkdirp "~0.5.0" nopt "~3.0.1"

this worked for me. I copied it from an older vue project.

This worked for me

rm -rf node_modules/ npm install js-beautify@1.6.14 npm install npm install cross-env npm run dev

@hydrostasis npm install -g vue-cli --registry=https://registry.npm.taobao.org try this

sequelize-cli also breaks. Just waiting for the fix that I hope gets done today.

also I had a problem with node-sass today: I solved the problem this way: 1)npm update 2)npm install 3)nodejs node_modules/node-sass/scripts/install.js 4)npm rebuild node-sass maybe someone will come in handy

  "bin": {
    "css-beautify": "./js/bin/css-beautify.js",
    "html-beautify": "./js/bin/html-beautify.js",
    "js-beautify": "./js/bin/js-beautify.js"
  },

These three JS files not exist in 1.7.0 released pkg.

+10086

I was getting ready to jump off a cliff before stumbling here. 😹

me too, this save me

npm install -g js-beautify@1.6.14

vue-cli fails to install

Be my guest to make a PR. This is just a notification to the dev to show what the impact is of this issue.

I think some npm packages are using “js-beautify”: “^1.6.14” at the moment…

@evocateur that’s helpful for people but it’s also a huge issue as Atom/Atom-Beta packages are broken and there is not a good way to force those internal packages. The atom package manager (apm) and the packages for Atom Editor are broken since many of them including atom-beautify use this package directly.

I agree that if you are on NPM/Yarn project you can easily and quickly fix this but for other users, this is quite breaking.

Global installation of “js-beautify” to solve the problem
cnpm install js-beautify@1.6.14 -g

we are fucked.

This is the most monday of any monday I have had for a long time.

This worked yea,

rm -rf node_modules/
npm install js-beautify@1.6.14
npm install
npm install cross-env
npm run dev

Broken here as well

this works for me.

package.json:

  "resolutions": {
     "js-beautify": "1.6.14"
   }

强帖留名!

haha 论lock 的重要性

+1

We are fucked

vue-loader is fucked. I wasted 40 minutes thinking something was wrong with my webpack config.

Yarn would not even report an error, NPM did. So I’m dropping Yarn, back to NPM

@zuolin777 You don’t have to, just add “js-beautify”: “1.6.14” into your package.json dependencies, then it should work.

@RuinSain, Windows 10 is a real serious problem. Get rid of it immediately!

Emergency fix for vue-loader is incoming: https://github.com/vuejs/vue-loader/commit/97bd432bba4350988bfd0db6d7a1a514b66a9826

adding "js-beautify": "1.6.14", to my package.json worked. Thanks @weizs

for vue-cli vue-init webpack project-name cd project-name npm install js-beautify@1.6.14 --save-dev npm install works for me

@huysh3 i tried and have the same issue

昨晚上开始的

As stated here multiple times - use the older version of js-beautify npm install js-beautify@1.6.14

Stop with the +1 so people can easily see the solution while the poor dev tries to fix things

Guys, you broke the Internet… 😦

Guys… “plus ones” are so annoying and useless.

Again, just use the previous tag until this gets fixed.

If you have problem with running your vue-cli project npm install js-beautify@1.6.14 fixed the problem for me.

@briced We all know that one guy… 21743186_1094977500632127_3965491206705224243_n

Btw…post mortem… “Don’t publish unnessessary files” 😉

https://github.com/beautify-web/js-beautify/pull/1241

Same here, installing our package now crashes because of this. We had to release patch for last 3 versions replacing "js-beautify": "^1.6.4", with "js-beautify": "~1.6.4",

the day, they drove my source-code down… singz in country

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 4.9.41-moby
npm ERR! argv "/usr/local/nvm/versions/node/v6.9.1/bin/node" "/usr/local/nvm/versions/node/v6.9.1/bin/npm" "install"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.8
npm ERR! path /usr/src/app/node_modules/js-beautify/js/bin/css-beautify.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod

npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/src/app/node_modules/js-beautify/js/bin/css-beautify.js'
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/src/app/node_modules/js-beautify/js/bin/css-beautify.js'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/src/app/npm-debug.log

the issue i have is that i can’t install vue-cli not just js-beautify… i can get js-beautify with your solution but i still not have vue-cli

If you are facing issues because of a global dependency like me, make sure to install as follows:

RUN npm set progress=false && \
    npm install -g js-beautify@1.6.14 pm2@2.5 jake@8.0.15 sequelize-cli@2.8.0

Having multiple RUN statements won’t so install everything in one.

This worked for me

npm install -g npm

Then

npm install js-beautify@1.6.14

@tst11 this isn’t working for me XD

A stack trace from my webpack config

Module build failed: Error: Cannot find module './lib/beautify'
        at Function.Module._resolveFilename (module.js:470:15)
        at Function.Module._load (module.js:418:25)
        at Module.require (module.js:498:17)
        at require (internal/module.js:20:19)
        at /efs/clientasg12q/lsae/node_modules/js-beautify/js/index.js:74:27
        at Object.<anonymous> (/efs/clientasg12q/lsae/node_modules/js-beautify/js/index.js:80:7)
        at Module._compile (module.js:571:32)
        at Object.Module._extensions..js (module.js:580:10)
        at Module.load (module.js:488:32)
        at tryModuleLoad (module.js:447:12)
        at Function.Module._load (module.js:439:3)
        at Module.require (module.js:498:17)
        at require (internal/module.js:20:19)
        at Object.<anonymous> (/efs/clientasg12q/lsae/node_modules/vue-loader/lib/template-compiler.js:4:16)
        at Module._compile (module.js:571:32)
        at Object.Module._extensions..js (module.js:580:10)
        at Module.load (module.js:488:32)
        at tryModuleLoad (module.js:447:12)
        at Function.Module._load (module.js:439:3)
        at Module.require (module.js:498:17)
        at require (internal/module.js:20:19)
        at loadLoader (/efs/clientasg12q/lsae/node_modules/loader-runner/lib/loadLoader.js:13:17)
        at iteratePitchingLoaders (/efs/clientasg12q/lsae/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
        at runLoaders (/efs/clientasg12q/lsae/node_modules/loader-runner/lib/LoaderRunner.js:362:2)
        at NormalModule.doBuild (/efs/clientasg12q/lsae/node_modules/webpack/lib/NormalModule.js:182:3)
        at NormalModule.build (/efs/clientasg12q/lsae/node_modules/webpack/lib/NormalModule.js:275:15)
        at Compilation.buildModule (/efs/clientasg12q/lsae/node_modules/webpack/lib/Compilation.js:149:10)
        at factoryCallback (/efs/clientasg12q/lsae/node_modules/webpack/lib/Compilation.js:337:12)
        at factory (/efs/clientasg12q/lsae/node_modules/webpack/lib/NormalModuleFactory.js:241:5)
        at applyPluginsAsyncWaterfall (/efs/clientasg12q/lsae/node_modules/webpack/lib/NormalModuleFactory.js:94:13)

we are fucked

Pushing code on a Sunday evening and going to sleep. Safe to say, Monday will be interesting to say the least.

npm is npm - shame, it would quite easy to avoid such situations, just make dummy package.json with most used packages and before someone updates any of those, make sure this dummy thing builds.

Temporarily, if you have a local copy of your project which work, try npm-shrinkwrap, update all the reference to js-beautify and add the npm-shrinkwrap.json file.

You will fix all version of all dependencies of your project but with with a working version of js-beautify if you npm. As soon as the latest version will be fixed, remove the npm-shrinkwrap.json file.

This issue is breaking the laravel npm install as well…

I’m trying all the above hacks but nothing worked so far. I try to deploy my app with now and the webpack build fails:

Module build failed: Error: Cannot find module './lib/beautify'

I added the resolution to package.json without success. Any other idea what to add?

What caused this problem? It still doesn’t work for me with webpack builds. Am fucked.

@hydrostasis just create a file npm-shrinkwrap.json parallel to package.json. Create this file manually as you create others.

Change my package.json to version 1.6.14 helps to me for the “sequelize-cli” issue: … “dependencies”: { … “request”: “^2.81.0”, “js-beautify”: “1.6.14”, “sequelize”: “^4.8.2”, …

@steven-qi Where is the package.json file stored? Trying to install vue-cli but I can’t.

Can not fix it use below steps

  • Remove yarn.lock and node_modules
  • Add old version(@1.6.14) to dependencies
  • yarn

The steps is incorrent? @danrot

Same here, but then how do I start the npm run dev it gives the log of:

> cross-env NODE_ENV=development webpack-dev-server --open --inline --hot

sh: cross-env: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! vue-cli@ dev: `cross-env NODE_ENV=development webpack-dev-server --open --inline --hot`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the vue-cli@ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/gsm/.npm/_logs/2017-09-18T09_18_56_345Z-debug.log

@LinusBorg, I kinda enjoy the show 🍿

Can fix this problem now!!

npm install js-beautify@1.6.14

In a laravel-mix and vue environment (maybe other setups too) easy fix can be:

npm install --save-dev js-beautify@1.6.14

Building now works for me.

@abdullah Do you have a yarn.lock file in your project? If you do, yarn use this file to get the locked versions of your dependencies, so you don’t download the last (broken) version.

guess I’ll be switching to yarn for good after this mess is fixed.

try yarn 👍

this is the issue (ty @gafung ) 😃

+1

Same here, we found out in a production release (thanks to npm cache).

+11

+1

I install vue-cli use cnpm。it tell me “ no such file or directory, chmod 'C:\Users\zxrnh\AppData\Roaming\npm\node_modules\vue-cli\node_modules_js-beautify@1.7.0@js-beautify\js\bin\css-beautify.js“

this is my code cnpm install -g vue-cli who can help you !

@oronoa Add this package in your package.json with version lock for 1.6.14. It will override others.

vue-cli npm install works well if you add dependency in package.json “js-beautify”: “1.6.14”,

@danrot how do I fix webpack ?