node-sass icon indicating copy to clipboard operation
node-sass copied to clipboard

node scripts/install.js fails on Ubuntu 14.04

Open modsoussi opened this issue 9 years ago • 13 comments

  • NPM version (npm -v): v3.10.9
  • Node version (node -v):v6.9.2
  • Node Process (node -p process.versions):
{ http_parser: '2.7.0',
node: '6.9.2',
v8: '5.1.281.88',
uv: '1.9.1',
zlib: '1.2.8',
ares: '1.10.1-DEV',
icu: '56.1',
modules: '48',
openssl: '1.0.2j' }
  • Node Platform (node -p process.platform):linux
  • Node architecture (node -p process.arch):x64
  • node-sass version (node -p "require('node-sass').info"):
fs.js:951
  return binding.readdir(pathModule._makeLong(path), options.encoding);
                 ^

Error: ENOENT: no such file or directory, scandir '/opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass/vendor'
    at Error (native)
    at Object.fs.readdirSync (fs.js:951:18)
    at Object.getInstalledBinaries (/opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass/lib/extensions.js:121:13)
    at foundBinariesList (/opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass/lib/errors.js:20:15)
    at foundBinaries (/opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass/lib/errors.js:15:5)
    at Object.module.exports.missingBinary (/opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass/lib/errors.js:45:5)
    at module.exports (/opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass/lib/binding.js:15:30)
    at Object.<anonymous> (/opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/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 node-sass versions (npm ls node-sass):
[email protected] /opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard
└─┬ [email protected]
  └── [email protected] 

I had node v0.10.25 and node-sass started acting out after I updated node to v6.9.2. This is the error message I get when I try to run npm rebuild node-sass:

> [email protected] install /opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass
> node scripts/install.js

module.js:471
    throw err;
    ^

Error: Cannot find module '/opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass/scripts/install.js'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

npm ERR! Linux 3.13.0-91-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "rebuild" "node-sass"
npm ERR! node v6.9.2
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node scripts/install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, 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 information on how to open an issue for this project with:
npm ERR!     npm bugs node-sass
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls node-sass
npm ERR! There is likely additional logging output above.


modsoussi avatar Dec 30 '16 17:12 modsoussi

What happens when you just clear your node_modules and try reinstalling with the prebuilt binaries?

nschonni avatar Dec 30 '16 19:12 nschonni

Do you have the same issue if you try it in a clean directory? That's part of the troubleshooting guide https://github.com/sass/node-sass/blob/master/TROUBLESHOOTING.md#debugging-installation-issues

nschonni avatar Dec 30 '16 20:12 nschonni

It doesn't produce that error in a clean workspace. It installed a different version than the one I'm having trouble with!

modsoussi avatar Dec 30 '16 20:12 modsoussi

The version didn't actually matter. I installed the same version I installed in the clean directory, ran npm rebuild node-sass and still got the same error.

modsoussi avatar Dec 30 '16 20:12 modsoussi

It also produces the same error when I try to install node-sass in a clean node_modules directory. This is what I get:

npm WARN prefer global [email protected] should be installed with -g

> [email protected] install /opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass
> node scripts/install.js

module.js:471
    throw err;
    ^

Error: Cannot find module '/opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass/scripts/install.js'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3
[email protected] /opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard
└── [email protected]  extraneous

npm ERR! Linux 3.13.0-91-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "node-sass"
npm ERR! node v6.9.2
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node scripts/install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, 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 information on how to open an issue for this project with:
npm ERR!     npm bugs node-sass
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls node-sass
npm ERR! There is likely additional logging output above.

modsoussi avatar Dec 30 '16 22:12 modsoussi

Delete your node_modules and run npm install again

On 31 Dec. 2016 4:36 am, "Mohamed Soussi" [email protected] wrote:

  • NPM version (npm -v): v3.10.9
  • Node version (node -v):v6.9.2
  • Node Process (node -p process.versions): { http_parser: '2.7.0', node: '6.9.2', v8: '5.1.281.88', uv: '1.9.1', zlib: '1.2.8', ares: '1.10.1-DEV', icu: '56.1', modules: '48', openssl: '1.0.2j' }
  • Node Platform (node -p process.platform):linux
  • Node architecture (node -p process.arch):x64
  • node-sass version (node -p "require('node-sass').info"):3.13.1
  • npm node-sass versions (npm ls node-sass):[email protected] /opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard [email protected] (node-sass) invalid error: ENOENT: no such file or directory, open '/opt/daycation/frontend/hotel-dashboard/default/ daycation-dashboard/node_modules/gulp-sass/node_ modules/node-sass/package.json [email protected] extraneous

I had node version 0.10.25 and node-sass started acting out after I updated node to v6.9.2. This is the error message I get when I try to run npm rebuild node-sass:

[email protected] install /opt/daycation/frontend/hotel- dashboard/default/daycation-dashboard/node_modules/node-sass node scripts/install.js

module.js:471 throw err; ^

Error: Cannot find module '/opt/daycation/frontend/ hotel-dashboard/default/daycation->dashboard/node_ modules/node-sass/scripts/install.js' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:509:3

npm ERR! Linux 3.13.0-91-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "rebuild" "node-sass" npm ERR! node v6.9.2 npm ERR! npm v3.10.9 npm ERR! code ELIFECYCLE npm ERR! [email protected] install: node scripts/install.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] install script 'node scripts/install.js'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, 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 information on how to open an issue for this project with: npm ERR! npm bugs node-sass npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls node-sass npm ERR! There is likely additional logging output above.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sass/node-sass/issues/1847, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjZWIzix6D6izjmN0f52Rh0lxXTE8USks5rNUEUgaJpZM4LYTYT .

xzyfer avatar Dec 31 '16 01:12 xzyfer

That also doesn't work. I ran a verbose install and this is what I get:

> [email protected] install /opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass
> node scripts/install.js

module.js:471
    throw err;
    ^

Error: Cannot find module '/opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass/scripts/install.js'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3
npm verb lifecycle [email protected]~install: unsafe-perm in lifecycle false
npm verb lifecycle [email protected]~install: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass/node_modules/.bin:/opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
npm verb lifecycle [email protected]~install: CWD: /opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass
npm info lifecycle [email protected]~install: Failed to exec install script
npm verb unlock done using /home/mo/.npm/_locks/staging-1af1c63a26f39aa6.lock for /opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/.staging
npm verb stack Error: [email protected] install: `node scripts/install.js`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
npm verb stack     at emitTwo (events.js:106:13)
npm verb stack     at EventEmitter.emit (events.js:191:7)
npm verb stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14)
npm verb stack     at emitTwo (events.js:106:13)
npm verb stack     at ChildProcess.emit (events.js:191:7)
npm verb stack     at maybeClose (internal/child_process.js:877:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
npm verb pkgid [email protected]
npm verb cwd /opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard
npm ERR! Linux 3.13.0-91-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "--verbose"
npm ERR! node v6.9.2
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node scripts/install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, 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 information on how to open an issue for this project with:
npm ERR!     npm bugs node-sass
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls node-sass
npm ERR! There is likely additional logging output above.
npm verb exit [ 1, true ]

modsoussi avatar Dec 31 '16 02:12 modsoussi

Looks like a couple different issues are happening here. Can you try adding the --unsafe-perm flag to npm install?

On 31 Dec. 2016 1:28 pm, "Mohamed Soussi" [email protected] wrote:

That also doesn't work. I ran a verbose install and this is what I get:

[email protected] install /opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass node scripts/install.js

module.js:471 throw err; ^

Error: Cannot find module '/opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass/scripts/install.js' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:509:3 npm verb lifecycle [email protected]~install: unsafe-perm in lifecycle false npm verb lifecycle [email protected]~install: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass/node_modules/.bin:/opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin npm verb lifecycle [email protected]~install: CWD: /opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass npm info lifecycle [email protected]~install: Failed to exec install script npm verb unlock done using /home/mo/.npm/_locks/staging-1af1c63a26f39aa6.lock for /opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/.staging

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sass/node-sass/issues/1847#issuecomment-269844450, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjZWIi4Uqcn3rCmSv6nE7K4If9KmJvHks5rNb3jgaJpZM4LYTYT .

xzyfer avatar Dec 31 '16 03:12 xzyfer

That worked! Any idea what the issue was?

modsoussi avatar Dec 31 '16 03:12 modsoussi

npm runs it lifecycle scripts as a restricted user so they can't do anything too malicious. That user didn't have permissions for the directory you're running npm install from.

xzyfer avatar Dec 31 '16 04:12 xzyfer

@xzyfer niubility!!!

tntcpu avatar Aug 28 '17 02:08 tntcpu

You'll need the flag whenever running npm as a privileged user. This is an npm security feature that we can do nothing about.

On Fri., 2 Nov. 2018, 8:58 am Shawn Moore <[email protected] wrote:

Looks like a couple different issues are happening here. Can you try adding the --unsafe-perm flag to npm install? … <#m_-1859203363994765014_> On 31 Dec. 2016 1:28 pm, "Mohamed Soussi" @.> wrote: That also doesn't work. I ran a verbose install and this is what I get: > @. install /opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass

node scripts/install.js module.js:471 throw err; ^ Error: Cannot find module '/opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass/scripts/install.js' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:509:3 npm verb lifecycle @.~install: unsafe-perm in lifecycle false npm verb lifecycle @.~install: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass/node_modules/.bin:/opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin npm verb lifecycle @.~install: CWD: /opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/node-sass npm info lifecycle @.~install: Failed to exec install script npm verb unlock done using /home/mo/.npm/_locks/staging-1af1c63a26f39aa6.lock for /opt/daycation/frontend/hotel-dashboard/default/daycation-dashboard/node_modules/.staging — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#1847 (comment) https://github.com/sass/node-sass/issues/1847#issuecomment-269844450>, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjZWIi4Uqcn3rCmSv6nE7K4If9KmJvHks5rNb3jgaJpZM4LYTYT .

Is this still an issue. I am still having to do this on AWS.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sass/node-sass/issues/1847#issuecomment-435201488, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjZWDmr_iWNh-pTL7MSsVd8tGbPVcC7ks5uq26ggaJpZM4LYTYT .

xzyfer avatar Nov 01 '18 22:11 xzyfer

I get stuck to this problem for a couple of days and finally, it solved by adding the --unsafe-perm flag when npm install?

moelzanaty3 avatar Nov 16 '18 20:11 moelzanaty3