Node-sass: Recieve error when install node-sass by yarn .

Created on 3 Nov 2016  ยท  13Comments  ยท  Source: sass/node-sass

I have installed node-sass by yarn, but I get error:

error /home/zendkofy/public_html/react-redux/visualsliderdesigner/node_modules/node-sass: Command failed.
Exit code: 1
Command: sh
Arguments: -c node scripts/install.js
Directory: /home/zendkofy/public_html/react-redux/visualsliderdesigner/node_modules/node-sass
Output:
path.js:7
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.join (path.js:1211:7)
    at /home/zendkofy/public_html/react-redux/visualsliderdesigner/node_modules/node-sass/scripts/install.js:122:26
    at /home/zendkofy/public_html/react-redux/visualsliderdesigner/node_modules/mkdirp/index.js:30:20
    at FSReqWrap.oncomplete (fs.js:123:15)
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Could you please let me know to fix this error ?

Most helpful comment

I just solved it by setting the cache config to yarn. It seems like yarn does set all npm_config_* env vars, but cache doesn't exist by default.

$ yarn config set cache ~/.my-yarn-cache-dir

All 13 comments

@nschonni this also looks tangentially related to the cache patch. My guess is yarn isn't BC with npm config.

@NicolasAndersen what version of yarn are you using?

@xzyfer I'm having the same issue on yarn v0.16.1

Modifying the yarn.lock file back to node-sass version 3.10.0 is the temporary workaround I'm using right now.

Thanks @scottcarlson this is a bug in yarn that was exposed by a recent change in node-sass.

Opened an issue with yarn - https://github.com/yarnpkg/yarn/issues/1632

thank @xzyfer and @scottcarlson . I using yarn version 0.16.1. I have removed folder node_modules then use npm install and it worked. Thank you again. You can close this ticket.

I'll leave this open. This is an issue for yarn support.

I just solved it by setting the cache config to yarn. It seems like yarn does set all npm_config_* env vars, but cache doesn't exist by default.

$ yarn config set cache ~/.my-yarn-cache-dir

Interesting observation @daltones. That's a case we currently do no handle gracefully.

I have a work around in #1782.

Thanks for the workaround, @daltones. This worked for me:

jbruni@vm:~$ yarn cache dir
yarn cache v0.16.1
/home/jbruni/.yarn-cache
Done in 0.05s.
jbruni@vm:~$ yarn config set cache ~/.yarn-cache
yarn config v0.16.1
success Set "cache" to "/home/jbruni/.yarn-cache".
Done in 0.10s.

yarn cache dir returns the current cache dir.

I've released v3.11.1 with a patch until yarn is fixed.

this command helped me a lot
yarn --cache-folder ~/.my-yarn-cache-dir/

so here is the story:
i was downloading a new repo from github.. the instractions of instalation tell that i should install yarn globaly and then execute yarn
npm i -g yarn && yarn
after that i had an erro like
yarn install v1.9.4 [1/6] Validating package.json... [2/6] Resolving packages... [3/6] Fetching packages... info There appears to be trouble with your network connection. Retrying... info [email protected]: The platform "linux" is incompatible with this module. info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation. [4/6] Linking dependencies... [5/6] Building fresh packages... [-/5] โ   waiting... [-/5] โ   waiting... [-/5] โ   waiting... [4/5] โ  node-sass error /media/root/dev/programmation/dev web/trudesk/node_modules/node-sass: Command failed. Exit code: 135 Command: node scripts/build.js Arguments: Directory: /media/root/dev/programmation/dev web/trudesk/node_modules/node-sass Output: Binary found at /media/root/dev/programmation/dev web/trudesk/node_modules/node-sass/vendor/linux-x64-57/binding.node

i saw all comments here and i found the answer of @jbruni (thank you man by the way :) ) but it could help me.. so when i did yarn --help i found --cache-folder <path> for specifying cache folder ... the magic happened .. all my problem solved and the result was like

root@ghost:/media/root/dev/programmation/dev web/trudesk# yarn yarn install v1.9.4 [1/6] Validating package.json... [2/6] Resolving packages... success Already up-to-date. Done in 1.68s.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexandrubau picture alexandrubau  ยท  3Comments

Rudloff picture Rudloff  ยท  3Comments

mkbctrl picture mkbctrl  ยท  4Comments

harukaeru picture harukaeru  ยท  3Comments

liuyuqiang picture liuyuqiang  ยท  3Comments