Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Can't install node-sass during deployment #1138

Closed
cibulka opened this issue Sep 11, 2015 · 24 comments
Closed

Can't install node-sass during deployment #1138

cibulka opened this issue Sep 11, 2015 · 24 comments

Comments

@cibulka
Copy link

cibulka commented Sep 11, 2015

Hello everyone!

I am using gulp-sass 2.0.4 (that uses node-sass 3.3.2). Installing it locally to my development works without any problem. The problem is my remote production environment, installation to server through ssh (with Capistrano deployment) fails.

Error: ENOENT, no such file or directory '/www/cibulka.me/wwwroot/www/releases/20150910223016/node_modules/cibulka-gulp-tasks/node_modules/gulp-sass/node_modules/node-sass/node'
    at Error (native)
    at Object.fs.lstatSync (fs.js:792:18)
    at Object.realpathSync (fs.js:1383:21)
    at getRuntimeInfo (/www/cibulka.me/wwwroot/www/releases/20150910223016/node_modules/cibulka-gulp-tasks/node_modules/gulp-sass/node_modules/node-sass/lib/extensions.js:35:21)
    at Object.<anonymous> (/www/cibulka.me/wwwroot/www/releases/20150910223016/node_modules/cibulka-gulp-tasks/node_modules/gulp-sass/node_modules/node-sass/lib/extensions.js:120:16)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)

My hosting provider uses node 0.12.6. All other NPM modules seem to be installing fine.

Can you tell me what am I doing wrong? Thank you!

@xzyfer
Copy link
Contributor

xzyfer commented Sep 11, 2015

Hi @cibulka, please follow our troubleshooting doc and post all the output into a gist.

@cibulka
Copy link
Author

cibulka commented Sep 11, 2015

Sorry I have not do that from the start!

web713@webhosting-a ~ $ npm -v              
2.11.2
web713@webhosting-a ~ $ node -v
v0.12.6
web713@webhosting-a ~ $ node -p process.versions
{ http_parser: '2.3',
  node: '0.12.6',
  v8: '3.28.71.19',
  uv: '1.4.2',
  zlib: '1.2.8',
  modules: '14',
  openssl: '1.0.2d' }
web713@webhosting-a ~ $ node -p process.platform
linux
web713@webhosting-a ~ $ node -p process.arch
x64

Node-sass versions (copied from my local environment, as the installation did not finish remotely):

{
  "name": "node-sass",
  "version": "3.3.2",
  "libsass": "3.2.5",
}

For some reason, I can't find any npm_debug.log on my server. Maybe it is because the file is gitgnored from my repository?

Also, I do not run the npm installation as sudo. I can't really do that, as I am on shared hosting.

Is there anything else I can post?

@cibulka
Copy link
Author

cibulka commented Sep 11, 2015

Also, I can confirm that I get same error if I hit npm install gulp-sass --save through plain SSH, so Capistrano and my deployment process is likely not the issue ...

npm WARN deprecated pangyp@2.3.2: use node-gyp@3+, it does all the things
-
> node-sass@3.3.2 install /www/cibulka.me/wwwroot/www/releases/20150909203122/node_modules/cibulka-gulp-tasks/node_modules/gulp-sass/node_modules/node-sass
> node scripts/install.js

fs.js:792
  return binding.lstat(pathModule._makeLong(path));
                 ^
Error: ENOENT, no such file or directory '/www/cibulka.me/wwwroot/www/releases/20150909203122/node_modules/cibulka-gulp-tasks/node_modules/gulp-sass/node_modules/node-sass/node'
    at Error (native)
    at Object.fs.lstatSync (fs.js:792:18)
    at Object.realpathSync (fs.js:1383:21)
    at getRuntimeInfo (/www/cibulka.me/wwwroot/www/releases/20150909203122/node_modules/cibulka-gulp-tasks/node_modules/gulp-sass/node_modules/node-sass/lib/extensions.js:35:21)
    at Object.<anonymous> (/www/cibulka.me/wwwroot/www/releases/20150909203122/node_modules/cibulka-gulp-tasks/node_modules/gulp-sass/node_modules/node-sass/lib/extensions.js:120:16)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
npm ERR! Linux 3.17.7-hardened-r1
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "gulp-sass" "--save"
npm ERR! node v0.12.6
npm ERR! npm  v2.11.2
npm ERR! code ELIFECYCLE

npm ERR! node-sass@3.3.2 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@3.3.2 install script 'node scripts/install.js'.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node scripts/install.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-sass
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /www/cibulka.me/wwwroot/www/releases/20150909203122/node_modules/cibulka-gulp-tasks/npm-debug.log

@xzyfer
Copy link
Contributor

xzyfer commented Sep 11, 2015

Do have the /www/cibulka.me/wwwroot/www/releases/20150909203122/node_modules/cibulka-gulp-tasks/npm-debug.log?

Otherwise can you please paste output of npm install gulp-sass --verbose into a https://gist.github.com/.

Please do not post it here because it will be too much to read.

@cibulka
Copy link
Author

cibulka commented Sep 11, 2015

Here you go!

@xzyfer
Copy link
Contributor

xzyfer commented Sep 11, 2015

Hmm nothing jumps out at me and the log is surprisingly unhelpful

17714 verbose linkMans node-sass@3.3.2
17715 verbose rebuildBundles node-sass@3.3.2
17716 verbose rebuildBundles [ '.bin',
17716 verbose rebuildBundles   'async-foreach',
17716 verbose rebuildBundles   'chalk',
17716 verbose rebuildBundles   'gaze',
17716 verbose rebuildBundles   'get-stdin',
17716 verbose rebuildBundles   'glob',
17716 verbose rebuildBundles   'meow',
17716 verbose rebuildBundles   'mkdirp',
17716 verbose rebuildBundles   'nan',
17716 verbose rebuildBundles   'npmconf',
17716 verbose rebuildBundles   'pangyp',
17716 verbose rebuildBundles   'request',
17716 verbose rebuildBundles   'sass-graph' ]
17717 silly gentlyRm /www/cibulka.me/wwwroot/www/releases/20150909203122/node_modules/gulp-sass/node_modules/.bin/node-sass is being purged
17718 verbose gentlyRm don't care about contents; nuking /www/cibulka.me/wwwroot/www/releases/20150909203122/node_modules/gulp-sass/node_modules/.bin/node-sass
17719 info install node-sass@3.3.2
17720 verbose unsafe-perm in lifecycle true
17721 info node-sass@3.3.2 Failed to exec install script
17722 verbose unlock done using /home/web713/.npm/_locks/node-sass-08cf067dbba46fc2.lock for /www/cibulka.me/wwwroot/www/releases/20150909203122/node_modules/gulp-sass/node_modules/node-sass
17723 verbose about to build /www/cibulka.me/wwwroot/www/releases/20150909203122/node_modules/gulp-sass
17724 verbose unlock done using /home/web713/.npm/_locks/gulp-sass-a3fdad41b75822f2.lock for /www/cibulka.me/wwwroot/www/releases/20150909203122/node_modules/gulp-sass
17725 verbose stack Error: node-sass@3.3.2 install: `node scripts/install.js`
17725 verbose stack Exit status 1
17725 verbose stack     at EventEmitter.<anonymous> (/usr/lib64/node_modules/npm/lib/utils/lifecycle.js:213:16)
17725 verbose stack     at EventEmitter.emit (events.js:110:17)
17725 verbose stack     at ChildProcess.<anonymous> (/usr/lib64/node_modules/npm/lib/utils/spawn.js:24:14)
17725 verbose stack     at ChildProcess.emit (events.js:110:17)
17725 verbose stack     at maybeClose (child_process.js:1015:16)
17725 verbose stack     at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
17726 verbose pkgid node-sass@3.3.2
17727 verbose cwd /www/cibulka.me/wwwroot/www/releases/20150909203122
17728 error Linux 3.17.7-hardened-r1
17729 error argv "/usr/bin/node" "/usr/bin/npm" "install" "gulp-sass" "--save"
17730 error node v0.12.6
17731 error npm  v2.11.2
17732 error code ELIFECYCLE
17733 error node-sass@3.3.2 install: `node scripts/install.js`
17733 error Exit status 1
17734 error Failed at the node-sass@3.3.2 install script 'node scripts/install.js'.
17734 error This is most likely a problem with the node-sass package,
17734 error not with npm itself.
17734 error Tell the author that this fails on your system:
17734 error     node scripts/install.js
17734 error You can get their info via:
17734 error     npm owner ls node-sass
17734 error There is likely additional logging output above.
17735 verbose exit [ 1, true ]

@cibulka
Copy link
Author

cibulka commented Sep 11, 2015

I've contacted my surprisingly friendly hosting provider about this - maybe he will be able to help us somehow. Thanks for quick replies so far!

@rushcat
Copy link

rushcat commented Sep 11, 2015

I have the same problem after upgraded the npm from v1.4.12 (https://nodejs.org/download/release/npm/npm-1.4.12.zip) to v2.11.3 (https://nodejs.org/download/release/v0.12.7/node-v0.12.7-linux-x64.tar.gz node v0.12.7 built-in). Thanks.

@saper
Copy link
Member

saper commented Sep 11, 2015

@cibulka is node on your $PATH ? It seems to me it isn't. npm install executes a normal shell and tells it to run node scripts/install.js. If it can't find node (or this is some kind of funky restricted shell), things won't work.

@saper
Copy link
Member

saper commented Sep 11, 2015

@rushcat Please follow our TROUBLESHOOTING.md guide, check other already open issues and open a new one, if still having issues.

@cibulka
Copy link
Author

cibulka commented Sep 11, 2015

@saper It seems to be, although I admit, that due to the fact that I use shared hosting, my paths are little funky.

web713@webhosting-a ~ $ which node
/usr/bin/node
web713@webhosting-a ~ $ echo $PATH
/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.4

As I wrote above, every other npm dependency (A LOT of gulp plugins) installs without a problem. So if I had problems with $PATH, wouldn't they be affected as well?

Also, node scripts/install.js seems to search at the right place, I think?

web713@webhosting-a ~ $ node scripts/install.js
module.js:338
    throw err;
          ^
Error: Cannot find module '/home/web713/scripts/install.js'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3
    at node.js:814:3

@saper
Copy link
Member

saper commented Sep 11, 2015

Not really. It can be the only module that executes its own scripts outside of node environment.

What kind of shell are you running?

@saper
Copy link
Member

saper commented Sep 11, 2015

Not sure if you can modify your npm, but it would be cool if you could apply npm/npm#9227 and see more information there.

@cibulka
Copy link
Author

cibulka commented Sep 11, 2015

Those are the NPM libraries that install without issue (except gulp-sass of course):

  "dependencies": {
    "asset-builder": "^1.1.0",
    "gulp": "^3.9.0",
    "gulp-autoprefixer": "^3.0.1",
    "gulp-cheerio": "^0.6.2",
    "gulp-combine-media-queries": "^0.2.0",
    "gulp-concat": "^2.6.0",
    "gulp-image-resize": "^0.6.0",
    "gulp-imagemin": "^2.3.0",
    "gulp-load-plugins": "^0.10.0",
    "gulp-minify-css": "^1.2.1",
    "gulp-plumber": "^1.0.1",
    "gulp-rename": "^1.2.2",
    "gulp-sass": "^2.0.4",
    "gulp-svg2png": "^0.3.0",
    "gulp-svgfallback": "^3.0.2",
    "gulp-svgstore": "^5.0.4",
    "gulp-uglify": "^1.4.0",
    "gulp-wp-file-header": "0.0.4",
    "json-sass": "^1.3.5",
    "lazypipe": "^1.0.1",
    "merge": "^1.2.0",
    "merge-stream": "^1.0.0"
  },

What kind of shell am I running - is bash the answer? :) Sorry for my ignorance.

@cibulka
Copy link
Author

cibulka commented Sep 11, 2015

And by npm/npm#9227 you mean to upgrade Node to 3.3.1? I'm affraid I can't do that. I hope that my hosting provider will check this issue though, so maybe he can help us with that ...

@saper
Copy link
Member

saper commented Sep 11, 2015 via email

@cibulka
Copy link
Author

cibulka commented Sep 11, 2015

Sorry for my ignorance again, but how do I do that?

If it would involve any file modifications / updating (which I believe it would), I still think I would not have rights to do that. My production environment is a shared hosting.

@saper
Copy link
Member

saper commented Sep 11, 2015

npm is basically running something like

 /bin/sh -c node script/install.js

with node-sass being the current directory. What can go wrong:

  1. /bin/sh is not working
  2. /bin/sh cannot find node
  3. node is some script doing strange things
  4. current directory is different than expected
  5. script/install.js is not there for some reason
  6. node cannot find script/install.js

You need to have node-sass unpacked in order to try node script/install.js - for example taken from git via git clone git://github.com/sass/node-sass (npm should unpack it for you before trying to run the script).

@saper
Copy link
Member

saper commented Sep 11, 2015

What happens if you just npm install node-sass, without using gulp-sass at all?

@saper
Copy link
Member

saper commented Sep 11, 2015

My suspicion is that your environment is somehow hardened so you cannot run node without giving absolute path (or something similar). Your host might know more.

@cibulka
Copy link
Author

cibulka commented Sep 11, 2015

Thank you!

I will get in touch with the host and report here tomorrow afternoon the latest. I would really like to find a solution to this before The Deadline Monday. :)

  • node-sass fails the same way as gulp-sass

@cibulka
Copy link
Author

cibulka commented Sep 13, 2015

So here's what my host says: It is necessary to have /proc filesystem mounted. Without it, node is not able to resolve absolute path correctly.

I'm not really sure what that means, but I hope someone with a similar issue would find it helpful here. Thanks for the effort!

@cibulka cibulka closed this as completed Sep 13, 2015
@saper
Copy link
Member

saper commented Sep 13, 2015

That's interesting. What kind of operating system is this?

@saper saper reopened this Sep 13, 2015
@saper saper closed this as completed Sep 13, 2015
@cibulka
Copy link
Author

cibulka commented Sep 17, 2015

As it turns out, the mystery issue lies somewhere else than in "/proc filesystem". No idea where though.

Due to serious time pressure, I had to switch my deployment worflow to ruby sass (while still using node-sass locally). When there will be a little more time, me and my host will try to investigate the issue more and will let you know if anything comes up!

jiongle1 pushed a commit to scantist-ossops-m2/node-sass that referenced this issue Apr 7, 2024
Fix order of top nodes (comments and imports)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants