NPM version: 5.03
Node version: 8.1.1
Node Process: { http_parser: '2.7.0',
node: '8.1.1',
v8: '5.8.283.41',
uv: '1.12.0',
zlib: '1.2.11',
ares: '1.10.1-DEV',
modules: '57',
openssl: '1.0.2l',
icu: '59.1',
unicode: '9.0',
cldr: '31.0.1',
tz: '2017b' }
Node Platform: linux
Node architecture: x64
node-sass version: 4.5.3
Installation fails with the following error:
$ npm install node-sass
> [email protected] install /home/vagrant/workspace/mui/node_modules/node-sass
> node scripts/install.js
module.js:487
throw err;
^
Error: Cannot find module 'tough-cookie'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/vagrant/envs/mui-env/lib/node_modules/request/lib/cookies.js:3:13)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
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.
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! /home/vagrant/.npm/_logs/2017-06-14T13_09_09_105Z-debug.log
We are seeing something similar only cannot find module request
We're seeing an issue related to this, but manifesting itself as a 404 for https://nodejs.org/download//v8.1.1/node-v8.1.1-headers.tar.gz
To add to this, I have node-sass as a devDependency and I'm seeing Cannot find module 'request' the first time I npm i. The second time I see Cannot find module 'caseless'. the third time, I get no errors.
Alright what I found out was I had a bad package-lock.json. After deleting and running an install I was good to go.
@comfroels did you also delete node_modules/? Or run a cache clear?
Did a git clean -xdf.... so just deleted node_modules
I deleted node_modules and package-lock.json, and a npm i worked. However there was no diff with my previous lockfile. So I deleted my node_modules and tried installing again, but got the "Cannot find module 'request'" error. I think the lockfile is causing this somehow.
Hmm... very interesting. let me try an npm i with the current lockfile I have. The strange thing is that I have our npm to get passed through myget so we can pick up our private packages. I wasn't sure if that had anything to with it. But it seems like it doesn't
Alright, I cleared my node_modules again and npm install'd the with the package-lock.json and it worked fine. So it appears mine was definitely that original package-lock I had
I want to confirm a similar instance with yarn. I installed node v8.1.1 and webpack threw errors about node-sass. I attempted to perform npm rebuild node-sass but that failed. I landed here and read the comments, so I tried deleting my yarn.lock file and node_modules dir and it started working.
Wonder what the issue with the lock files is??
Closing as this is an issue with NPM rather than node-sass. Check out the resolution at the end of #1991
in #1991 - NPM suggests to the the npm cache clean command as npm cache clean --force

Comes with a warning too (Uhrua reference?):

Most helpful comment
Alright what I found out was I had a bad
package-lock.json. After deleting and running an install I was good to go.