Sonali
Sonali

Reputation: 783

npm install : unable to install dependencies in Windows 10

I am using Windows 10 and installed node-v6.9.1-x64.

Here is the project link which I am trying to build for Android platform and for that I am following steps as mentioned there, like:

  1. First of all I have downloaded this project and unzip to Ionic folder in D drive and renamed it to IonicUserBase

  2. Second, I have already Ionic and Cordova installed, so I directly started with navigate to project

  3. Third to install all dependencies, I am using : npm install

But unable to install dependecies .... see complete log below

D:\>cd Ionic

D:\Ionic>cd IonicUserBase

D:\Ionic\IonicUserBase>npm install
npm WARN deprecated [email protected]: Please use gulp-clean-css
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.

> [email protected] install D:\Ionic\IonicUserBase\node_modules\node-sass
> node build.js

(node:6292) DeprecationWarning: child_process: options.customFds option is deprecated. Use options.stdio instead.

D:\Ionic\IonicUserBase\node_modules\node-sass>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:449:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:404:11
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:123:15)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Ionic\IonicUserBase\node_modules\node-sass
gyp ERR! node -v v6.9.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
Build failed
[                 .] | install: info lifecycle [email protected]~install: Failed to exec install script[                 .] | install: info lifecycle [email protected][email protected] D:\Ionic\IonicUserBase
+-- [email protected]
+-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | | `-- [email protected]
| | +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | | `-- [email protected]
| | | +-- [email protected]
| | | | `-- [email protected]
| | | +-- [email protected]
| | | | +-- [email protected]
| | | | | `-- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | | +-- [email protected]
| | | | | | `-- [email protected]
| | | | | |   +-- [email protected]
| | | | | |   +-- [email protected]
| | | | | |   | `-- [email protected]
| | | | | |   +-- [email protected]
| | | | | |   `-- [email protected]
| | | | | +-- [email protected]
| | | | | `-- [email protected]
| | | | +-- [email protected]
| | | | | `-- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | | `-- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | | +-- [email protected]
| | | | | | `-- [email protected]
| | | | | `-- [email protected]
| | | | +-- [email protected]
| | | | | +-- [email protected]
| | | | | | `-- [email protected]
| | | | | `-- [email protected]
| | | | `-- [email protected]
| | | |   +-- [email protected]
| | | |   `-- [email protected]
| | | `-- [email protected]
| | |   `-- [email protected]
| | |     +-- [email protected]
| | |     | +-- [email protected]
| | |     | +-- [email protected]
| | |     | | `-- [email protected]
| | |     | `-- [email protected]
| | |     |   `-- [email protected]
| | |     `-- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | `-- [email protected]
| | |   +-- [email protected]
| | |   | `-- [email protected]
| | |   |   `-- [email protected]
| | |   |     `-- [email protected]
| | |   +-- [email protected]
| | |   `-- [email protected]
| | |     `-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | | `-- [email protected]
| | |   `-- [email protected]
| | +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| `-- [email protected]
|   +-- [email protected]
|   | `-- [email protected]
|   +-- [email protected]
|   | +-- [email protected]
|   | | `-- [email protected]
|   | +-- [email protected]
|   | | `-- [email protected]
|   | +-- [email protected]
|   | | `-- [email protected]
|   | |   +-- [email protected]
|   | |   `-- [email protected]
|   | +-- [email protected]
|   | +-- [email protected]
|   | | `-- [email protected]
|   | `-- [email protected]
|   +-- [email protected]
|   | `-- [email protected]
|   |   `-- [email protected]
|   |     +-- [email protected]
|   |     | +-- [email protected]
|   |     | `-- [email protected]
|   |     +-- [email protected]
|   |     `-- [email protected]
|   |       +-- [email protected]
|   |       `-- [email protected]
|   +-- [email protected]
|   | `-- [email protected]
|   +-- [email protected]
|   | `-- [email protected]
|   +-- [email protected]
|   | +-- [email protected]
|   | `-- [email protected]
|   +-- [email protected]
|   | `-- [email protected]
|   `-- [email protected]
|     `-- [email protected]
+-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| `-- [email protected]
|   +-- [email protected]
|   | +-- [email protected]
|   | +-- [email protected]
|   | +-- [email protected]
|   | `-- [email protected]
|   `-- [email protected]
+-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | `-- [email protected]
| |   `-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| `-- [email protected]
|   `-- [email protected]
+-- [email protected]
+-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | | `-- [email protected]
| | +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | `-- [email protected]
| |   +-- [email protected]
| |   | `-- [email protected]
| |   +-- [email protected]
| |   +-- [email protected]
| |   | +-- [email protected]
| |   | | `-- [email protected]
| |   | `-- [email protected]
| |   +-- [email protected]
| |   +-- [email protected]
| |   | +-- [email protected]
| |   | +-- [email protected]
| |   | | `-- [email protected]
| |   | `-- [email protected]
| |   |   +-- [email protected]
| |   |   | `-- [email protected]
| |   |   `-- [email protected]
| |   +-- [email protected]
| |   +-- [email protected]
| |   | +-- [email protected]
| |   | | +-- [email protected]
| |   | | `-- [email protected]
| |   | |   `-- [email protected]
| |   | `-- [email protected]
| |   |   +-- [email protected]
| |   |   | +-- [email protected]
| |   |   | +-- [email protected]
| |   |   | | `-- [email protected]
| |   |   | |   `-- [email protected]
| |   |   | +-- [email protected]
| |   |   | `-- [email protected]
| |   |   `-- [email protected]
| |   +-- [email protected]
| |   | +-- [email protected]
| |   | | `-- [email protected]
| |   | |   `-- [email protected]
| |   | |     `-- [email protected]
| |   | `-- [email protected]
| |   `-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | | `-- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | | `-- [email protected]
| | | `-- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | `-- [email protected]
| | +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | `-- [email protected]
| `-- [email protected]
|   `-- [email protected]
`-- [email protected]

npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node build.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 build.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 ERR! Please include the following file with any support request:
npm ERR!     D:\Ionic\IonicUserBase\npm-debug.log

D:\Ionic\IonicUserBase>

UPDATED:

I have tried the way suggested by @mscdex and here is the new log, still getting build failed while using npm install and one more thing now I have installed another version of nodejs (i.e. node-v4.2.1-x64)

Upvotes: 7

Views: 8435

Answers (4)

Newton Joshua
Newton Joshua

Reputation: 741

I cloned the project and tried the same.

By adding PythonPath to the Windows environment and updating the gulp-sass to it's latest version I am able to build the project successfully

Step 1:

Download Python 2.7.12 from here

And set the environment variable PATH to /path/to/executable/python2.7 (eg: C:\Python27\python.exe)

OR

open cmd as administrator and run

npm install --g --production windows-build-tools 

I have done both.

Step 2:

Open your package.json (D:\Ionic\IonicUserBase\package.json)

change the version of gulp-sass from "gulp-sass": "^0.7.1" to it's latest version "gulp-sass": "^2.3.2"

now try npm install

It should work fine.

Summary: Let me summarize the entire flow

Open cmd as admin

npm install -g cordova ionic
npm install --g --production windows-build-tools from cmd as administrator
git clone https://github.com/malikov/Authenticate.me-client-cordova-ionic.git
cd Authenticate.me-client-cordova-ionic 

In package.json change the version of gulp-sass to it's latest version. "gulp-sass": "^2.3.2"

npm install
ionic platform add android
ionic run android

Upvotes: 6

Ethan May
Ethan May

Reputation: 1292

Have you tried running npm rebuild node-sass?

If that doesn't work, then you likely need to go into your package.json and update your dependencies. When I get messy node errors I usually do something like this:

Delete your node_modules folder and back up your package.json. Then remove all the dependencies from your package.json and install each one manually using npm install package_name --save. This will install the latest version of each package - and it will likely fix your problem. I have experienced inconsistencies with npm update which is why I recommend this manual process.

Upvotes: 2

mscdex
mscdex

Reputation: 106696

node-sass is a node addon, so it needs to be compiled. However, you don't have at least Python installed to be able to compile addons.

On Windows, you should be able to install everything you need by just doing this (either from an elevated PowerShell session or from a command prompt ran as Administrator):

npm install --global --production windows-build-tools

Once that successfully completes, re-run your original npm install.

EDIT: After reading your npm install log, it appears that you are depending on an old version of gulp-sass since a really old version of node-sass is being installed (node-sass v0.9.6 was released in 2014). Try installing and using the latest version of gulp-sass (v2.3.2 as of this writing) instead, which should bring in a much more recent node-sass that is compatible with modern versions of node.

Upvotes: 2

M14
M14

Reputation: 1810

I had a similar version i solved by installing python 2.7

npm install --python=python2.7

or set it to be used always:

npm config set python python2.7

Also i had visual stdio 2015 and 2012 installed.

npm install --global --production windows-build-tools

Upvotes: 2

Related Questions