Yarn: [0.17.0] Issues with node-sass

Created on 15 Nov 2016  ยท  41Comments  ยท  Source: yarnpkg/yarn

What is the current behavior?

yarn install v0.17.0
info No lockfile found.
error npm-shrinkwrap.json found. This will not be updated or respected. See https://yarnpkg.com/en/docs/migrating-from-npm for more information.
[1/4] ๐Ÿ”  Resolving packages...
warning istanbul > istanbul-api > fileset > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
[4/4] ๐Ÿ“ƒ  Building fresh packages...
[1/2] โก€ fsevents: sh: node-pre-gyp: command not found
[2/2] โก€ node-sass
[-/2] โก€ waiting...
[-/2] โ  waiting...
[2/2] โ  node-sass:     at Timer.unrefdHandle (timers.js:312:14)
[-/2] โ  waiting...
[-/2] โ  waiting...
error /Users/hassankhan/Projects/react-dashboard/node_modules/node-sass: Command failed.
Exit code: 1
Command: sh
Arguments: -c node scripts/install.js
Directory: /Users/hassankhan/Projects/react-dashboard/node_modules/node-sass
Output:
http node-sass install Downloading binary from https://github.com/sass/node-sass/releases/download/v3.12.4/darwin-x64-46_binding.node
/Users/hassankhan/Projects/react-dashboard/node_modules/gauge/render-template.js:67
          throw new error.MissingTemplateValue(cloned, values)
          ^

Error: Missing template value "progressbar"
    at cloneAndObjectify (/Users/hassankhan/Projects/react-dashboard/node_modules/gauge/render-template.js:67:17)
    at Array.map (native)
    at prepareItems (/Users/hassankhan/Projects/react-dashboard/node_modules/gauge/render-template.js:83:25)
    at module.exports (/Users/hassankhan/Projects/react-dashboard/node_modules/gauge/render-template.js:16:15)
    at Object.Plumbing.show (/Users/hassankhan/Projects/react-dashboard/node_modules/gauge/plumbing.js:45:10)
    at Object.Gauge._doRedraw (/Users/hassankhan/Projects/react-dashboard/node_modules/gauge/index.js:219:40)
    at null.<anonymous> (/Users/hassankhan/Projects/react-dashboard/node_modules/gauge/index.js:15:19)
    at wrapper (timers.js:275:11)
    at Timer.unrefdHandle (timers.js:312:14)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

If the current behavior is a bug, please provide the steps to reproduce.
Have a package that uses node-sass as a dependency, then run yarn install. Running it a second time will complete the install, but node-sass will not work.

What is the expected behavior?

No errors, just fun.

Please mention your node.js, yarn and operating system version.
Node v4.6.0
Yarn v0.17.0
macOS 10.11.6

cat-bug

Most helpful comment

FYI It wasn't working for me right after upgrading yarn to v0.17.4, but this fixed it:

yarn cache clean
rm -rf node_modules
yarn install

All 41 comments

Can't reproduce this with latest master:

~/work/yarn/artifacts/dist/bin/yarn add node-sass
yarn add v0.18.0-0
info No lockfile found.
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
[4/4] ๐Ÿ“ƒ  Building fresh packages...
success Saved lockfile.
success Saved 180 new dependencies.
โ”œโ”€ [email protected]
...

@hassankhan, can you checkout master and try on it?

I can confirm this is happening with our CI build with yarn 17. It works when I clear the cache but like @hassankhan mentioned it happens on the second run.

Node v6.1.0
Yarn v0.17.0
ubuntu 14.04

I just tried with the latest master, and while I do see Building fresh packages... in the output, I need to run npm rebuild node-sass afterwards in order for the app to run.

Node 7.1.0
Yarn 0.18.0-0
OS X 10.11.6

This is now resolved for me with Yarn 0.17.2.

Closing this. Please feel free to let us know if you face this problem in >= v0.17.2

I'm sorry, I spoke too soon. I thought I tested this with my postinstall work-around removed, but apparently not. I am still experiencing this problem with v0.17.2.

@jswanner no worries. Thanks for reporting it back though ๐Ÿ˜„

Sorry, late to the party, but yeah same thing, no dice ๐Ÿ˜ข

FYI on my project (which has a lot of dependencies, but I think this is the problem).

I can see that Yarn (0.17.2) removes some dependencies after a run. Notice the lines stating unbuild ... below:

$ yarn
yarn install v0.17.2
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
warning Unmet peer dependency "eslint@>=0.16.0".
warning Unmet peer dependency "jasmine-core@*".
warning Unmet peer dependency "request@^2.34".
warning Unmet peer dependency "request@^2.34".
[4/4] ๐Ÿ“ƒ  Building fresh packages...
$ bower install && npm prune && bower prune
(node:2271) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.

bower tinymce-dist    extra-resolution Unnecessary resolution: tinymce-dist#4.3.12
unbuild [email protected]
unbuild [email protected]
unbuild [email protected]
unbuild [email protected]
(node:2298) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
โœจ  Done in 18.13s.

After the yarn command and the unbuild steps, I get the following error running my tests. Note the failing section is inside node-sass:

$ npm t

> [email protected] test ~/secret_project/
> gulp test

fs.js:951
  return binding.readdir(pathModule._makeLong(path), options.encoding);
                 ^

Error: ENOENT: no such file or directory, scandir '~/secret_project/node_modules/node-sass/vendor'
    at Error (native)
    at Object.fs.readdirSync (fs.js:951:18)
    at Object.getInstalledBinaries (~/secret_project/node_modules/node-sass/lib/extensions.js:121:13)
    at foundBinariesList (~/secret_project/node_modules/node-sass/lib/errors.js:20:15)
    at foundBinaries (~/secret_project/node_modules/node-sass/lib/errors.js:15:5)
    at Object.module.exports.missingBinary (~/secret_project/node_modules/node-sass/lib/errors.js:45:5)
    at module.exports (~/secret_project/node_modules/node-sass/lib/binding.js:15:30)
    at Object.<anonymous> (~/secret_project/node_modules/node-sass/lib/index.js:14:35)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
npm ERR! Test failed.  See above for more details.

Then, if I run npm rebuild node-sass, I am able to proceed.

But then phantomjs-prebuilt will give the next failure:

17 11 2016 11:18:57.578:ERROR [plugin]: Error during loading "~/secret_project/node_modules/karma-phantomjs-launcher" plugin:
  Path must be a string. Received null

So, the dependencies being unbuilt in the final step are as far as I can see not being removed by npm prune. Somehow npm prune and yarn's unbuild do different things??

So I am trying to repro on master branch:

$ yarn add node-sass
yarn add v0.18.0-0
info No lockfile found.
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
[4/4] ๐Ÿ“ƒ  Building fresh packages...
success Saved lockfile.
success Saved 180 new dependencies.
โ”œโ”€ [email protected]
...
โœจ  Done in 8.94s.
$ ls -al node_modules/node-sass/vendor/darwin-x64-48/
total 5088
drwxr-xr-x  3 bestander Domain Users      102 Nov 17 16:02 .
drwxr-xr-x  3 bestander  Domain Users      102 Nov 17 16:01 ..
-rw-r--r--  1 bestander  Domain Users  2602136 Nov 17 16:02 binding.node

Everything seems in place.
Can anyone give me a 100% list of commands to reproduce this?
Is it linux/windows only?

I think binding.node is downloaded instead of being rebuilt.
Could that be a reason?

Anyway, we need a step by step guide to repro this

@bestander it wasn't working me for either. The build step wasn't happening. After a yarn cache clean, it worked.

Can anyone give me a 100% list of commands to reproduce this?

This seems to be very difficult to reproduce consistently. ๐Ÿ˜• It easily brings up red herrings, since it's likely that something you try at first seemingly fixes it, and then it only resurfaces later.

@STRML has some ongoing work in https://github.com/yarnpkg/yarn/issues/1852#issuecomment-261273692 / https://github.com/STRML/yarn-install-lifecycle-bug if someone else manages to get a reliable repro case.

As far as I can see, this looks like the same root issue as #1848, #1852 and #1872, right? Or has there been some indication that there are two separate things going on?

Is it linux/windows only?

OS X 10.11.6 here.

These all seem related.

For those of you currently experiencing it, could you please make copies of your local and homedir .npmrc and .yarnrc, if any, and then try removing them and reinstalling? See if that clears it up. If it does, let's see if there's a common thread among them.

In my case, removing and recreating my .npmrc fixed the issue, even though the new .npmrc had the same content. I can no longer reproduce the bug.

So just updated to Yarn 0.17.4 and running yarn doesn't result in any errors for me any more. I would close the issue, but others seem to still be having problems.

Yes they all seem related.

1817, related as well, got fixed between 0.17.0 and 0.17.3

@hassankhan, if you run yarn cache clean && rm -rf node_modules, it should reproduce this.

I had the same problem, removing node-sass from the cache fixed it on the next run.

I also noticed some segmentation fault while running yarn on projects with a lot of dependencies and the cache was empty, and after it happened, node-sass had been put in the node_modules folder, but vendor wasn't there. So I suspect that the segmentation fault happens when the post install scripts are run.
And then people re-run yarn and yarn thinks node-sass is properly installed, which is not the case.

Something like that... but I can't find the error log anymore with yarn 0.17.3....

@wyze Nope, did what you said but I can't reproduce the error any more. Seems to be working fine now ๐Ÿ‘

https://github.com/yarnpkg/yarn/issues/1912 is important to fix - Yarn silences build errors and this leaves us with inconsistent state

Is this still a thing with 0.17.4? Hard to track if it is fixed or not.

Had started seeing something along these lines with the bump to 0.17.2.

I was unable to reproduce this on 0.17.4.

Bizarrely, now I have the sass error with 0.17.4. So something's still broken for sure. Trying to figure it out.

Clearing cache fixed the node-sass issue.

Just tested on OS X El Capitan with v0.17.4, seems to be fixed in latest. I'm curious, what fixed this bug?

I think it was #1663 that fixed this. Closing as it is resolved.

FYI It wasn't working for me right after upgrading yarn to v0.17.4, but this fixed it:

yarn cache clean
rm -rf node_modules
yarn install

Still getting reports of this in 0.17.6 - https://github.com/sass/node-sass/issues/1804#issuecomment-261876302

Same as @Danita. Was seeing it in 0.17.9, just doing yarn cache clean; yarn install didn't help until I removed the node_modules folder as well and tried again.

Possibly related: #2104

Still happenening with yarn 0.19.1 :/ (Even after clearing the cache and deleting node_modules)

0.20.0 fixed it for OSX, but still getting this on Linux with Codeship. The vendor folder just isn't there :(

Still not fixed with 0.21.3 on macOS 10.12 :(

// package.json
"scripts": {
    "update": "yarn install && npm rebuild node-sass"
  },

๐Ÿ˜ข

For those who still have this issue please open a new one with steps to reproduce and cc me

FYI, I no longer see this issue with yarn 22 and now 23 on macOS. Including fresh install for new project.

@kittens has taken notice to the issue and with issue #3224 hopefully we have a fix in the near future.

How to reproduce consistently:

CircleCI 2.0 Docker program.

1) Create your project as is with a package.json. Create yarn lock file via yarn install/upgrade.
2) Add node-sass or gulp-sass into project (Currently testing with gulp-sass)
3) Ensure proper tokens are hooked into repository to allow webhooks for CircleCI
4) Ensure project is configured to use CircleCI Beta 2.0 (Apply on their website)
5) Add the following into .circleci/config.yml.
6) Check in code.

The first run, the docker container will be built, no cache will exist, yarn will run an install, and then perform a successful compilation of sass using gulp-sass. It will succeed.

Do another noop checkin. The following build will use the cache saved from the previous successful run, restore the cache, and then run a yarn install which will be very quick because cache has been restored. The next compilation command (the SASS/SCSS), will now consistently fail with:

yarn run css
yarn run v0.23.4
$ gulp css
fs.js:914
  return binding.readdir(pathModule._makeLong(path), options.encoding);
                 ^

Error: ENOENT: no such file or directory, scandir '/root/project/node_modules/node-sass/vendor'

./.circleci/config.yml

version: 2
jobs:
  build:
    working_directory: ~/project

    docker:
      - image: node:7.10

    steps:
      - checkout
      - restore_cache:
          key: deps-{{ .Branch }}-{{ checksum "yarn.lock" }}
      - run:
          command: yarn install --pure-lockfile --no-progress
      - save_cache:
          key: deps-{{ .Branch }}-{{ checksum "yarn.lock" }}
          paths:
            - node_modules
# ADD THIS COMMAND HERE THAT USES NODE-SASS / GULP-SASS
#      - run:
#          command: yarn run css  

Refs:

Commenting on old closed issue won't help, please create a new one if you have repro steps with latest yarn

Was this page helpful?
0 / 5 - 0 ratings