简体   繁体   English

npm install:无法在Windows 10中安装依赖项

[英]npm install : unable to install dependencies in Windows 10

I am using Windows 10 and installed node-v6.9.1-x64. 我使用的是Windows 10并安装了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: 这是我试图为Android平台构建的项目链接 ,为此我遵循那里提到的步骤,如:

  1. First of all I have downloaded this project and unzip to Ionic folder in D drive and renamed it to IonicUserBase 首先,我已下载此项目并解压缩到D盘中的Ionic文件夹并将其重命名为IonicUserBase

  2. Second, I have already Ionic and Cordova installed, so I directly started with navigate to project 其次,我已经安装了Ionic和Cordova,所以我直接开始导航到项目

  3. Third to install all dependencies, I am using : npm install 第三,安装所有依赖项,我正在使用:npm install

But unable to install dependecies .... see complete log below 但无法安装dependecies ....请参阅下面的完整日志

D:\>cd Ionic

D:\Ionic>cd IonicUserBase

D:\Ionic\IonicUserBase>npm install
npm WARN deprecated gulp-minify-css@0.3.13: Please use gulp-clean-css
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: 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 jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated graceful-fs@2.0.3: 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.

> node-sass@0.9.6 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 node-sass@0.9.6~install: Failed to exec install script[                 .] | install: info lifecycle node-sass@0.9.6~instAuthenticate.me@1.0.0 D:\Ionic\IonicUserBase
+-- bower@1.7.9
+-- gulp@3.9.1
| +-- archy@1.0.0
| +-- chalk@1.1.3
| | +-- ansi-styles@2.2.1
| | +-- escape-string-regexp@1.0.5
| | +-- has-ansi@2.0.0
| | | `-- ansi-regex@2.0.0
| | +-- strip-ansi@3.0.1
| | `-- supports-color@2.0.0
| +-- deprecated@0.0.1
| +-- interpret@1.0.1
| +-- liftoff@2.3.0
| | +-- extend@3.0.0
| | +-- findup-sync@0.4.3
| | | +-- detect-file@0.1.0
| | | | `-- fs-exists-sync@0.1.0
| | | +-- is-glob@2.0.1
| | | | `-- is-extglob@1.0.0
| | | +-- micromatch@2.3.11
| | | | +-- arr-diff@2.0.0
| | | | | `-- arr-flatten@1.0.1
| | | | +-- array-unique@0.2.1
| | | | +-- braces@1.8.5
| | | | | +-- expand-range@1.8.2
| | | | | | `-- fill-range@2.2.3
| | | | | |   +-- is-number@2.1.0
| | | | | |   +-- isobject@2.1.0
| | | | | |   | `-- isarray@1.0.0
| | | | | |   +-- randomatic@1.1.5
| | | | | |   `-- repeat-string@1.6.1
| | | | | +-- preserve@0.2.0
| | | | | `-- repeat-element@1.1.2
| | | | +-- expand-brackets@0.1.5
| | | | | `-- is-posix-bracket@0.1.1
| | | | +-- extglob@0.3.2
| | | | +-- filename-regex@2.0.0
| | | | +-- kind-of@3.0.4
| | | | | `-- is-buffer@1.1.4
| | | | +-- normalize-path@2.0.1
| | | | +-- object.omit@2.0.1
| | | | | +-- for-own@0.1.4
| | | | | | `-- for-in@0.1.6
| | | | | `-- is-extendable@0.1.1
| | | | +-- parse-glob@3.0.4
| | | | | +-- glob-base@0.3.0
| | | | | | `-- glob-parent@2.0.0
| | | | | `-- is-dotfile@1.0.2
| | | | `-- regex-cache@0.4.3
| | | |   +-- is-equal-shallow@0.1.3
| | | |   `-- is-primitive@2.0.0
| | | `-- resolve-dir@0.1.1
| | |   `-- global-modules@0.2.3
| | |     +-- global-prefix@0.1.4
| | |     | +-- ini@1.3.4
| | |     | +-- osenv@0.1.3
| | |     | | `-- os-tmpdir@1.0.2
| | |     | `-- which@1.2.11
| | |     |   `-- isexe@1.1.2
| | |     `-- is-windows@0.2.0
| | +-- fined@1.0.2
| | | +-- expand-tilde@1.2.2
| | | +-- lodash.assignwith@4.2.0
| | | +-- lodash.isempty@4.4.0
| | | +-- lodash.pick@4.4.0
| | | `-- parse-filepath@1.0.1
| | |   +-- is-absolute@0.2.6
| | |   | `-- is-relative@0.2.1
| | |   |   `-- is-unc-path@0.1.1
| | |   |     `-- unc-path-regex@0.1.2
| | |   +-- map-cache@0.2.2
| | |   `-- path-root@0.1.1
| | |     `-- path-root-regex@0.1.2
| | +-- flagged-respawn@0.3.2
| | +-- lodash.isplainobject@4.0.6
| | +-- lodash.isstring@4.0.1
| | +-- lodash.mapvalues@4.6.0
| | +-- rechoir@0.6.2
| | `-- resolve@1.1.7
| +-- minimist@1.2.0
| +-- orchestrator@0.3.7
| | +-- end-of-stream@0.1.5
| | | `-- once@1.3.3
| | |   `-- wrappy@1.0.2
| | +-- sequencify@0.0.7
| | `-- stream-consume@0.1.0
| +-- pretty-hrtime@1.0.2
| +-- semver@4.3.6
| +-- tildify@1.2.0
| | `-- os-homedir@1.0.2
| +-- v8flags@2.0.11
| | `-- user-home@1.1.1
| `-- vinyl-fs@0.3.14
|   +-- defaults@1.0.3
|   | `-- clone@1.0.2
|   +-- glob-stream@3.1.18
|   | +-- glob@4.5.3
|   | | `-- inflight@1.0.6
|   | +-- glob2base@0.0.12
|   | | `-- find-index@0.1.1
|   | +-- minimatch@2.0.10
|   | | `-- brace-expansion@1.1.6
|   | |   +-- balanced-match@0.4.2
|   | |   `-- concat-map@0.0.1
|   | +-- ordered-read-streams@0.1.0
|   | +-- through2@0.6.5
|   | | `-- readable-stream@1.0.34
|   | `-- unique-stream@1.0.0
|   +-- glob-watcher@0.0.6
|   | `-- gaze@0.5.2
|   |   `-- globule@0.1.0
|   |     +-- glob@3.1.21
|   |     | +-- graceful-fs@1.2.3
|   |     | `-- inherits@1.0.2
|   |     +-- lodash@1.0.2
|   |     `-- minimatch@0.2.14
|   |       +-- lru-cache@2.7.3
|   |       `-- sigmund@1.0.1
|   +-- graceful-fs@3.0.11
|   | `-- natives@1.1.0
|   +-- mkdirp@0.5.1
|   | `-- minimist@0.0.8
|   +-- strip-bom@1.0.0
|   | +-- first-chunk-stream@1.0.0
|   | `-- is-utf8@0.2.1
|   +-- through2@0.6.5
|   | `-- readable-stream@1.0.34
|   `-- vinyl@0.4.6
|     `-- clone@0.2.0
+-- gulp-concat@2.6.0
| +-- concat-with-sourcemaps@1.0.4
| | `-- source-map@0.5.6
| `-- through2@0.6.5
|   +-- readable-stream@1.0.34
|   | +-- core-util-is@1.0.2
|   | +-- inherits@2.0.3
|   | +-- isarray@0.0.1
|   | `-- string_decoder@0.10.31
|   `-- xtend@4.0.1
+-- gulp-minify-css@0.3.13
| +-- bufferstreams@0.0.2
| | `-- readable-stream@1.1.14
| +-- clean-css@3.0.10
| | +-- commander@2.5.1
| | `-- source-map@0.1.43
| |   `-- amdefine@1.0.0
| +-- memory-cache@0.0.5
| +-- through2@0.6.5
| | `-- readable-stream@1.0.34
| `-- vinyl-sourcemaps-apply@0.1.4
|   `-- source-map@0.1.43
+-- gulp-rename@1.2.2
+-- gulp-util@2.2.20
| +-- chalk@0.5.1
| | +-- ansi-styles@1.1.0
| | +-- has-ansi@0.1.0
| | | `-- ansi-regex@0.2.1
| | +-- strip-ansi@0.3.0
| | `-- supports-color@0.2.0
| +-- dateformat@1.0.12
| | +-- get-stdin@4.0.1
| | `-- meow@3.7.0
| |   +-- camelcase-keys@2.1.0
| |   | `-- camelcase@2.1.1
| |   +-- decamelize@1.2.0
| |   +-- loud-rejection@1.6.0
| |   | +-- currently-unhandled@0.4.1
| |   | | `-- array-find-index@1.0.2
| |   | `-- signal-exit@3.0.1
| |   +-- map-obj@1.0.1
| |   +-- normalize-package-data@2.3.5
| |   | +-- hosted-git-info@2.1.5
| |   | +-- is-builtin-module@1.0.0
| |   | | `-- builtin-modules@1.1.1
| |   | `-- validate-npm-package-license@3.0.1
| |   |   +-- spdx-correct@1.0.2
| |   |   | `-- spdx-license-ids@1.2.2
| |   |   `-- spdx-expression-parse@1.0.4
| |   +-- object-assign@4.1.0
| |   +-- read-pkg-up@1.0.1
| |   | +-- find-up@1.1.2
| |   | | +-- path-exists@2.1.0
| |   | | `-- pinkie-promise@2.0.1
| |   | |   `-- pinkie@2.0.4
| |   | `-- read-pkg@1.1.0
| |   |   +-- load-json-file@1.1.0
| |   |   | +-- graceful-fs@4.1.9
| |   |   | +-- parse-json@2.2.0
| |   |   | | `-- error-ex@1.3.0
| |   |   | |   `-- is-arrayish@0.2.1
| |   |   | +-- pify@2.3.0
| |   |   | `-- strip-bom@2.0.0
| |   |   `-- path-type@1.1.0
| |   +-- redent@1.0.0
| |   | +-- indent-string@2.1.0
| |   | | `-- repeating@2.0.1
| |   | |   `-- is-finite@1.0.2
| |   | |     `-- number-is-nan@1.0.1
| |   | `-- strip-indent@1.0.1
| |   `-- trim-newlines@1.0.0
| +-- lodash._reinterpolate@2.4.1
| +-- lodash.template@2.4.1
| | +-- lodash._escapestringchar@2.4.1
| | +-- lodash.defaults@2.4.1
| | | `-- lodash._objecttypes@2.4.1
| | +-- lodash.escape@2.4.1
| | | +-- lodash._escapehtmlchar@2.4.1
| | | | `-- lodash._htmlescapes@2.4.1
| | | `-- lodash._reunescapedhtml@2.4.1
| | +-- lodash.keys@2.4.1
| | | +-- lodash._isnative@2.4.1
| | | +-- lodash._shimkeys@2.4.1
| | | `-- lodash.isobject@2.4.1
| | +-- lodash.templatesettings@2.4.1
| | `-- lodash.values@2.4.1
| +-- minimist@0.2.0
| +-- multipipe@0.1.2
| | `-- duplexer2@0.0.2
| +-- through2@0.5.1
| | +-- readable-stream@1.0.34
| | `-- xtend@3.0.0
| `-- vinyl@0.2.3
|   `-- clone-stats@0.0.1
`-- shelljs@0.3.0

npm WARN Authenticate.me@1.0.0 No repository field.
npm WARN Authenticate.me@1.0.0 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! node-sass@0.9.6 install: `node build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@0.9.6 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 (ie node-v4.2.1-x64) 我已经尝试过@mscdex建议的方式,这里是新的日志 ,在使用npm install时仍然会出现构建失败现在还有一件事我安装了另一个版本的nodejs(即node-v4.2.1-x64)

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 通过将PythonPath添加到Windows环境并将gulp-sass更新为最新版本,我能够成功构建项目

Step 1: 第1步:

Download Python 2.7.12 from here 这里下载Python 2.7.12

And set the environment variable PATH to /path/to/executable/python2.7 (eg: C:\\Python27\\python.exe) 并将环境变量PATH设置为/path/to/executable/python2.7(例如:C:\\ Python27 \\ python.exe)

OR 要么

open cmd as administrator and run 以管理员身份打开cmd并运行

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

I have done both. 我做了两件事。

Step 2: 第2步:

Open your package.json (D:\\Ionic\\IonicUserBase\\package.json) 打开你的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" gulp-sass的版本从"gulp-sass": "^0.7.1"更改为"gulp-sass": "^0.7.1"到它的最新版本"gulp-sass": "^2.3.2"

now try npm install 现在尝试npm install

It should work fine. 它应该工作正常。

Summary: Let me summarize the entire flow 总结:让我总结一下整个流程

Open cmd as admin 管理员身份打开cmd

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. 在package.json中将gulp-sass的版本更改为它的最新版本。 "gulp-sass": "^2.3.2" “gulp-sass”:“^ 2.3.2”

npm install
ionic platform add android
ionic run android

node-sass is a node addon, so it needs to be compiled. node-sass是一个节点插件,因此需要进行编译。 However, you don't have at least Python installed to be able to compile addons. 但是,您至少安装了Python才能编译插件。

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): 在Windows上,您应该能够通过执行此操作来安装所需的一切(从提升的PowerShell会话或以管理员身份运行的命令提示符):

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

Once that successfully completes, re-run your original npm install . 成功完成后,重新运行原始的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). 编辑:在阅读你的npm install日志之后,看来你依赖于旧版本的gulp-sass因为正在安装一个非常旧版本的node-sass (2014年发布了node-sass v0.9.6)。 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. 尝试安装并使用最新版本的gulp-sass (编写本文时为v2.3.2),这应该引入一个与现代版本的节点兼容的更新的node-sass

I had a similar version i solved by installing python 2.7 我有一个类似的版本我通过安装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. 我还安装了2015年和2012年的visual stdio。

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

Have you tried running npm rebuild node-sass ? 你试过运行npm rebuild node-sass吗?

If that doesn't work, then you likely need to go into your package.json and update your dependencies. 如果这不起作用,那么您可能需要进入package.json并更新您的依赖项。 When I get messy node errors I usually do something like this: 当我遇到凌乱的节点错误时,我通常会这样做:

Delete your node_modules folder and back up your package.json . 删除node_modules文件夹并备份package.json Then remove all the dependencies from your package.json and install each one manually using npm install package_name --save . 然后从package.json删除所有依赖项,并使用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. 我遇到了与npm update不一致的问题,这就是我推荐这个手动过程的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM