(寻找解决方案?检查此问题的底部是否有解决方案)
已更新为Apache Cordova到Update 6的最新Visual Studio工具,但仍安装了最新的Node.JS(v5.6.0)。
创建一个新的空项目并第一次构建,给出了这个输出:
1>------ Build started: Project: BlankCordovaApp2, Configuration: Debug Android ------
1> Your environment has been set up for using Node.js 5.6.0 (x64) and npm.
1> ------ Ensuring correct global installation of package from source package directory: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\EXTENSIONS\APACHECORDOVATOOLS\packages\vs-tac
1> ------ Name from source package.json: vs-tac
1> ------ Version from source package.json: 1.0.34
1> ------ Package already installed globally at correct version.
1> ------ Cordova tools 5.4.1 already installed.
1> module.js:341
1> throw err;
1> ^
1>
1>MSBUILD : cordova-build error BLD401: Error : BLD00401 : Could not find module 'umask'. Please Go to Tools --> Options --> Tools for Apache Cordova --> Cordova Tools --> Clear Cordova Cache and try building again.
1> at Function.Module._resolveFilename (module.js:339:15)
1> at Function.Module._load (module.js:290:25)
1> at Module.require (module.js:367:17)
1> at require (internal/module.js:16:19)
1> at Object.<anonymous> (C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\npm\lib\utils\umask.js:1:75)
1> at Module._compile (module.js:413:34)
1> at Object.Module._extensions..js (module.js:422:10)
1> at Module.load (module.js:357:32)
1> at Function.Module._load (module.js:314:12)
1> at Module.require (module.js:367:17)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
然后运行Clear Cordova Cache,这是输出:
Clearing Apache Cordova cache...
Removing package vs-tac ...
Removing package vs-npm ...
Completed
重新启动,打开相同的空项目并构建,提供了以下输出:
1>------ Rebuild All started: Project: BlankCordovaApp2, Configuration: Debug Android ------
1> C:\Users\sondr\AppData\Roaming\npm\node_modules\vs-npm\2.14.9\npm -> C:\Users\sondr\AppData\Roaming\npm\node_modules\vs-npm\2.14.9\node_modules\npm\bin\npm-cli.js
1> C:\Users\sondr\AppData\Roaming\npm\node_modules\vs-npm\2.14.9
1> `-- npm@2.14.9
1> +-- abbrev@1.0.7
1> +-- ansi@0.3.0
1> +-- ansicolors@0.3.2
1> +-- ansistyles@0.1.3
1> +-- archy@1.0.0
1> +-- async-some@1.0.2
1> +-- block-stream@0.0.8
1> +-- char-spinner@1.0.1
1> +-- chmodr@1.0.2
1> +-- chownr@1.0.1
1> +-- cmd-shim@2.0.1
1> | `-- graceful-fs@3.0.8
1> +-- columnify@1.5.2
1> | +-- strip-ansi@3.0.0
1> | | `-- ansi-regex@2.0.0
1> | `-- wcwidth@1.0.0
1> | `-- defaults@1.0.2
1> | `-- clone@0.1.19
1> +-- config-chain@1.1.9
1> | `-- proto-list@1.2.4
1> +-- dezalgo@1.0.3
1> | `-- asap@2.0.3
1> +-- editor@1.0.0
1> +-- fs-vacuum@1.2.7
1> +-- fs-write-stream-atomic@1.0.4
1> +-- fstream@1.0.8
1> +-- fstream-npm@1.0.5
1> | `-- fstream-ignore@1.0.3
1> +-- github-url-from-git@1.4.0
1> +-- github-url-from-username-repo@1.0.2
1> +-- glob@5.0.15
1> | `-- path-is-absolute@1.0.0
1> +-- graceful-fs@4.1.2
1> +-- hosted-git-info@2.1.4
1> +-- inflight@1.0.4
1> +-- inherits@2.0.1
1> +-- ini@1.3.4
1> +-- init-package-json@1.9.1
1> | `-- promzard@0.3.0
1> +-- lockfile@1.0.1
1> +-- lru-cache@2.7.0
1> +-- minimatch@3.0.0
1> | `-- brace-expansion@1.1.1
1> | +-- balanced-match@0.2.1
1> | `-- concat-map@0.0.1
1> +-- mkdirp@0.5.1
1> | `-- minimist@0.0.8
1> +-- node-gyp@3.0.3
1> | +-- glob@4.5.3
1> | | `-- minimatch@2.0.10
1> | | `-- brace-expansion@1.1.0
1> | | +-- balanced-match@0.2.0
1> | | `-- concat-map@0.0.1
1> | +-- minimatch@1.0.0
1> | | `-- sigmund@1.0.1
1> | +-- path-array@1.0.0
1> | | `-- array-index@0.1.1
1> | | `-- debug@2.2.0
1> | | `-- ms@0.7.1
1> | `-- tar@1.0.3
1> +-- nopt@3.0.4
1> +-- normalize-git-url@3.0.1
1> +-- normalize-package-data@2.3.4
1> | `-- is-builtin-module@1.0.0
1> | `-- builtin-modules@1.1.0
1> +-- npm-cache-filename@1.0.2
1> +-- npm-install-checks@1.0.6
1> +-- npm-package-arg@4.0.2
1> +-- npm-registry-client@7.0.7
1> | +-- concat-stream@1.5.0
1> | | +-- readable-stream@2.0.2
1> | | | +-- core-util-is@1.0.1
1> | | | +-- isarray@0.0.1
1> | | | +-- process-nextick-args@1.0.3
1> | | | +-- string_decoder@0.10.31
1> | | | `-- util-deprecate@1.0.1
1> | | `-- typedarray@0.0.6
1> | `-- npmlog@2.0.2
1> | +-- ansi@0.3.1
1> | +-- are-we-there-yet@1.0.6
1> | | `-- delegates@1.0.0
1> | `-- gauge@1.2.5
1> | +-- has-unicode@2.0.0
1> | +-- lodash.pad@3.3.0
1> | | +-- lodash._root@3.0.0
1> | | `-- lodash.repeat@3.2.0
1> | +-- lodash.padleft@3.1.1
1> | | +-- lodash._basetostring@3.0.1
1> | | `-- lodash._createpadding@3.6.1
1> | `-- lodash.padright@3.1.1
1> +-- npm-user-validate@0.1.2
1> +-- npmlog@1.2.1
1> | +-- are-we-there-yet@1.0.4
1> | | `-- delegates@0.1.0
1> | `-- gauge@1.2.0
1> | +-- has-unicode@1.0.0
1> | +-- lodash.pad@3.1.0
1> | | +-- lodash._basetostring@3.0.0
1> | | `-- lodash._createpadding@3.6.0
1> | | `-- lodash.repeat@3.0.0
1> | +-- lodash.padleft@3.1.1
1> | `-- lodash.padright@3.1.1
1> +-- once@1.3.2
1> +-- opener@1.4.1
1> +-- osenv@0.1.3
1> | +-- os-homedir@1.0.0
1> | `-- os-tmpdir@1.0.1
1> +-- path-is-inside@1.0.1
1> +-- read@1.0.7
1> | `-- mute-stream@0.0.5
1> +-- read-installed@4.0.3
1> | +-- debuglog@1.0.1
1> | +-- readdir-scoped-modules@1.0.2
1> | `-- util-extend@1.0.1
1> +-- read-package-json@2.0.1
1> | `-- json-parse-helpfulerror@1.0.3
1> | `-- jju@1.2.0
1> +-- readable-stream@1.1.13
1> | +-- core-util-is@1.0.1
1> | +-- isarray@0.0.1
1> | `-- string_decoder@0.10.31
1> +-- realize-package-specifier@3.0.1
1> +-- request@2.65.0
1> | +-- aws-sign2@0.6.0
1> | +-- bl@1.0.0
1> | | `-- readable-stream@2.0.3
1> | | +-- core-util-is@1.0.1
1> | | +-- isarray@0.0.1
1> | | +-- process-nextick-args@1.0.3
1> | | +-- string_decoder@0.10.31
1> | | `-- util-deprecate@1.0.2
1> | +-- caseless@0.11.0
1> | +-- combined-stream@1.0.5
1> | | `-- delayed-stream@1.0.0
1> | +-- extend@3.0.0
1> | +-- forever-agent@0.6.1
1> | +-- form-data@1.0.0-rc3
1> | | `-- async@1.5.0
1> | +-- har-validator@2.0.2
1> | | +-- chalk@1.1.1
1> | | | +-- ansi-styles@2.1.0
1> | | | +-- escape-string-regexp@1.0.3
1> | | | +-- has-ansi@2.0.0
1> | | | | `-- ansi-regex@2.0.0
1> | | | +-- strip-ansi@3.0.0
1> | | | | `-- ansi-regex@2.0.0
1> | | | `-- supports-color@2.0.0
1> | | +-- commander@2.9.0
1> | | | `-- graceful-readlink@1.0.1
1> | | +-- is-my-json-valid@2.12.2
1> | | | +-- generate-function@2.0.0
1> | | | +-- generate-object-property@1.2.0
1> | | | | `-- is-property@1.0.2
1> | | | +-- jsonpointer@2.0.0
1> | | | `-- xtend@4.0.0
1> | | `-- pinkie-promise@1.0.0
1> | | `-- pinkie@1.0.0
1> | +-- hawk@3.1.0
1> | | +-- boom@2.10.0
1> | | +-- cryptiles@2.0.5
1> | | +-- hoek@2.16.3
1> | | `-- sntp@1.0.9
1> | +-- http-signature@0.11.0
1> | | +-- asn1@0.1.11
1> | | +-- assert-plus@0.1.5
1> | | `-- ctype@0.5.3
1> | +-- isstream@0.1.2
1> | +-- json-stringify-safe@5.0.1
1> | +-- mime-types@2.1.7
1> | | `-- mime-db@1.19.0
1> | +-- node-uuid@1.4.3
1> | +-- oauth-sign@0.8.0
1> | +-- qs@5.2.0
1> | +-- stringstream@0.0.5
1> | +-- tough-cookie@2.2.0
1> | `-- tunnel-agent@0.4.1
1> +-- retry@0.8.0
1> +-- rimraf@2.4.3
1> +-- semver@5.0.3
1> +-- sha@2.0.1
1> | `-- readable-stream@2.0.2
1> | +-- core-util-is@1.0.1
1> | +-- isarray@0.0.1
1> | +-- process-nextick-args@1.0.3
1> | +-- string_decoder@0.10.31
1> | `-- util-deprecate@1.0.1
1> +-- slide@1.1.6
1> +-- sorted-object@1.0.0
1> +-- spdx@0.4.1
1> | `-- spdx-license-ids@1.0.1
1> +-- tar@2.2.1
1> +-- text-table@0.2.0
1> +-- uid-number@0.0.6
1> +-- umask@1.1.0
1> +-- validate-npm-package-license@3.0.1
1> | +-- spdx-correct@1.0.1
1> | | `-- spdx-license-ids@1.0.2
1> | `-- spdx-expression-parse@1.0.0
1> | +-- spdx-exceptions@1.0.2
1> | `-- spdx-license-ids@1.0.2
1> +-- validate-npm-package-name@2.2.2
1> | `-- builtins@0.0.7
1> +-- which@1.2.0
1> | `-- is-absolute@0.1.7
1> | `-- is-relative@0.1.3
1> +-- wrappy@1.0.1
1> `-- write-file-atomic@1.1.3
1> Your environment has been set up for using Node.js 5.6.0 (x64) and npm.
1> ------ Ensuring correct global installation of package from source package directory: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\EXTENSIONS\APACHECORDOVATOOLS\packages\vs-tac
1> ------ Name from source package.json: vs-tac
1> ------ Version from source package.json: 1.0.34
1> ------ Package not currently installed globally.
1> ------ Installing globally from source package. This could take a few minutes...
1> Each package is licensed to you by its owner. Microsoft is not responsible for, nor does it grant any licenses to, third-party packages. Some packages may include dependencies which are governed by additional licenses. Follow the package source (feed) URL to determine any dependencies.
1> > edge-cs@0.3.0 install C:\Users\sondr\AppData\Roaming\npm\node_modules\vs-tac\node_modules\edge\node_modules\edge-cs
1> > node tools/install.js
1> > edge@5.0.0 install C:\Users\sondr\AppData\Roaming\npm\node_modules\vs-tac\node_modules\edge
1> > node tools/install.js
1> Success: platform check for edge.js: node.js x64 v5.6.0
1> C:\Users\sondr\AppData\Roaming\npm\vs-tac-cli -> C:\Users\sondr\AppData\Roaming\npm\node_modules\vs-tac\vs-tac-cli.cmd
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\npm requires glob@'~5.0.15' but will load
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\glob,
1> npm WARN unmet dependency which is version 4.0.6
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\npm requires graceful-fs@'~4.1.2' but will load
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\graceful-fs,
1> npm WARN unmet dependency which is version 3.0.8
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\npm requires lru-cache@'~3.2.0' but will load
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\lru-cache,
1> npm WARN unmet dependency which is version 2.7.3
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\npm requires minimatch@'~3.0.0' but will load
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\minimatch,
1> npm WARN unmet dependency which is version 1.0.0
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\npm requires nopt@'~3.0.6' but will load
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\nopt,
1> npm WARN unmet dependency which is version 3.0.1
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\npm requires request@'~2.67.0' but will load
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\request,
1> npm WARN unmet dependency which is version 2.47.0
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\npm requires rimraf@'~2.4.4' but will load
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\rimraf,
1> npm WARN unmet dependency which is version 2.5.0
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\npm requires semver@'~5.1.0' but will load
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\semver,
1> npm WARN unmet dependency which is version 4.3.6
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\npm requires tar@'~2.2.1' but will load
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\tar,
1> npm WARN unmet dependency which is version 1.0.2
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\npm requires uid-number@'0.0.6' but will load
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\uid-number,
1> npm WARN unmet dependency which is version 0.0.5
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\taco-cli\node_modules\form-data requires async@'~0.9.0' but will load
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\taco-cli\node_modules\async,
1> npm WARN unmet dependency which is version 1.4.2
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\taco-cli\node_modules\hash-files requires async@'0.x.x' but will load
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\taco-cli\node_modules\async,
1> npm WARN unmet dependency which is version 1.4.2
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\taco-cli\node_modules\hash-files requires glob@'3.x.x' but will load
1> npm WARN unmet dependency C:\Users\sondr\AppData\Roaming\npm\node_modules\taco-cli\node_modules\glob,
1> npm WARN unmet dependency which is version 5.0.15
1> vs-tac@1.0.34 C:\Users\sondr\AppData\Roaming\npm\node_modules\vs-tac
1> ├── q@1.0.1
1> ├── rimraf@2.2.6
1> ├── mkdirp@0.3.5
1> ├── semver@2.3.1
1> ├── adm-zip@0.4.4
1> ├── optimist@0.6.1 (wordwrap@0.0.3, minimist@0.0.10)
1> ├── elementtree@0.1.6 (sax@0.3.5)
1> ├── fstream@1.0.8 (inherits@2.0.1, graceful-fs@4.1.3, mkdirp@0.5.1)
1> ├── request@2.36.0 (aws-sign2@0.5.0, forever-agent@0.5.2, tunnel-agent@0.4.2, qs@0.6.6, oauth-sign@0.3.0, mime@1.2.11, json-stringify-safe@5.0.1, tough-cookie@2.2.1, node-uuid@1.4.7, http-signature@0.10.1, form-data@0.1.4, hawk@1.0.0)
1> ├── tar@0.1.20 (inherits@2.0.1, block-stream@0.0.8, fstream@0.1.31)
1> ├── vs-libimobile@0.0.2
1> ├── ripple-emulator@0.9.32 (connect-xcors@0.5.2, colors@0.6.0-1, open@0.0.3, accounting@0.4.1, request@2.12.0, moment@1.7.2, express@3.1.0)
1> └── edge@5.0.0 (nan@2.2.0, edge-cs@0.3.0)
1> ------ npm install of vs-tac@1.0.34 from C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\EXTENSIONS\APACHECORDOVATOOLS\packages\vs-tac completed.
1> ------ Cordova tools 5.4.1 already installed.
1> module.js:341
1> throw err;
1> ^
1>
1>MSBUILD : cordova-build error BLD401: Error : BLD00401 : Could not find module 'umask'. Please Go to Tools --> Options --> Tools for Apache Cordova --> Cordova Tools --> Clear Cordova Cache and try building again.
1> at Function.Module._resolveFilename (module.js:339:15)
1> at Function.Module._load (module.js:290:25)
1> at Module.require (module.js:367:17)
1> at require (internal/module.js:16:19)
1> at Object.<anonymous> (C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\npm\lib\utils\umask.js:1:75)
1> at Module._compile (module.js:413:34)
1> at Object.Module._extensions..js (module.js:422:10)
1> at Module.load (module.js:357:32)
1> at Function.Module._load (module.js:314:12)
1> at Module.require (module.js:367:17)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
对于我的Visual Studio选项,我已将$(PATH)变量移到“外部Web工具”的顶部,因此VS使用全局安装的Node.JS版本。
在vs-npm中有一个umask包:
C:\用户\ sondr \应用程序数据\漫游\ NPM \ node_modules \ VS-NPM \ 2.14.9 \ node_modules \ NPM \ node_modules \的umask
vs-tac模块文件夹中没有umask,因为没有对package.json的依赖。
首先我跑了“npm install taco-cli -g”。
然后我运行了“npm install umask -g”,它返回了缺少的npmlog包。然后运行“npm install npmlog -g”并再次构建项目。导致此错误输出:
1>------ Build started: Project: BlankCordovaApp2, Configuration: Debug Android ------
1> Your environment has been set up for using Node.js 5.6.0 (x64) and npm.
1> ------ Ensuring correct global installation of package from source package directory: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\EXTENSIONS\APACHECORDOVATOOLS\packages\vs-tac
1> ------ Name from source package.json: vs-tac
1> ------ Version from source package.json: 1.0.34
1> ------ Package already installed globally at correct version.
1> ------ Cordova tools 5.4.1 already installed.
1> C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\npm\lib\npm.js:19
1> , fs = gfs.gracefulify(require('fs'))
1> ^
1>
1> TypeError: gfs.gracefulify is not a function
1> at C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\npm\lib\npm.js:19:14
1> at Object.<anonymous> (C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\npm\lib\npm.js:469:3)
1> at Module._compile (module.js:413:34)
1> at Object.Module._extensions..js (module.js:422:10)
1> at Module.load (module.js:357:32)
1> at Function.Module._load (module.js:314:12)
1> at Module.require (module.js:367:17)
1> at require (internal/module.js:16:19)
1> at Object.<anonymous> (C:\Users\sondr\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\util.js:27:21)
1> at Module._compile (module.js:413:34)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
此错误发生在cordova文件夹中,所以我想也许问题现在与cordova有关并尝试了“npm install cordova -g”。
然后......它有效!
答案 0 :(得分:5)
因此,如果其他人有类似问题,请尝试以下方法:
npm install cordova -g
如果这没有用,请运行所有这些命令,看看你是否有同样的运气:
npm install taco-cli -g
npm install umask -g
npm install npmlog -g
npm install cordova -g
运行cordova命令将安装Cordova的第6版,Update 6应与之兼容。我之前正在运行5.4.1(我认为)。