1

我不能在 Windows Server 2008 上使用 npm install 。这种行为很奇怪。请参见:

PS C:\1> npm cache clear
PS C:\1> npm install
npm WARN package.json 1@0.0.0 No description
npm WARN package.json 1@0.0.0 No repository field.
npm WARN package.json 1@0.0.0 No README data
\
> optipng-bin@1.0.1 postinstall C:\1\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-optipng\node_modules\optipng-bin
> node lib/install.js

 fetch : https://raw.github.com/imagemin/optipng-bin/v1.0.1/vendor/win/optipng.exe
 progress : [====================] 100% 0.0s

 ? pre-build test passed successfully!

 > gifsicle@1.0.3 postinstall C:\1\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\gifsicle
 > node lib/install.js

 fetch : https://raw.github.com/imagemin/gifsicle-bin/v1.0.3/vendor/win/x64/gifsicle.exe
 progress : [====================] 100% 0.0s

? pre-build test passed successfully!

> jpegtran-bin@1.0.2 postinstall C:\1\node_modules\grunt-contrib-Imagemin\node_modules\imagemin\node_modules\imagemin-jpegtran\node_modules\jpegtran-bin
> node lib/install.js

 fetch : https://raw.github.com/imagemin/jpegtran-bin/v1.0.2/vendor/win/x64/jpegtran.exe
 progress : [====================] 100% 0.0s

 fetch : https://raw.github.com/imagemin/jpegtran-bin/v1.0.2/vendor/win/x64/libjpeg-62.dll
 progress : [====================] 100% 0.0s

 ‼ pre-build test failed, compiling from source...
 × { [Error: Command failed: '.' is not recognized as an internal or external command,operable program or batch file.] killed: false, code: 1, signal: null }

 > pngquant-bin@1.0.1 postinstall C:\1\node_modules\grunt-contrib-magemin\node_modules\imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin
 > node lib/install.js

 fetch : https://raw.github.com/imagemin/pngquant-bin/v1.0.1/vendor/win/pngquant.exe
 progress : [====================] 100% 0.0s

 ? pre-build test passed successfully!
 npm ERR! EEXIST, open 'C:\Users\TFSSERVICE\AppData\Roaming\npm-cache\cadb8e19-m-cache-lodash-2-4-1-package-tgz.lock'
 File exists: C:\Users\TFSSERVICE\AppData\Roaming\npm-cache\cadb8e19-m-cache-lodash-2-4-1-package-tgz.lock
 Move it away, and try again.

 npm ERR! System Windows_NT 6.1.7601
 npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
 npm ERR! cwd C:\1
 npm ERR! node -v v0.10.33
 npm ERR! npm -v 1.4.28
 npm ERR! path C:\Users\TFSSERVICE\AppData\Roaming\npm-cache\cadb8e19-m-cache-lodash-2-4-1-Package-tgz.lock
 npm ERR! code EEXIST
 npm ERR! errno 47
 npm ERR! not ok code 0

首先,有文件 C:\Users\TFSSERVICE\AppData\Roaming\npm-cache\cadb8e19-m-cache-lodash-2-4-1-Package-tgz.lock。注意短路径,只是 c:\1。其次,如果我再次输入 npm install ,它就可以工作。

PS C:\1> npm install
npm WARN package.json 1@0.0.0 No description
npm WARN package.json 1@0.0.0 No repository field.
npm WARN package.json 1@0.0.0 No README data
grunt@0.4.5 node_modules\grunt
├── dateformat@1.0.2-1.2.3
├── which@1.0.8
├── eventemitter2@0.4.14
├── getobject@0.1.0
├── rimraf@2.2.8
├── colors@0.6.2
├── async@0.1.22
├── grunt-legacy-util@0.2.0
├── hooker@0.2.3
├── exit@0.1.2
├── nopt@1.0.10 (abbrev@1.0.5)
├── minimatch@0.2.14 (sigmund@1.0.0, lru-cache@2.5.0)
├── glob@3.1.21 (inherits@1.0.0, graceful-fs@1.2.3)
├── lodash@0.9.2
├── coffee-script@1.3.3
├── underscore.string@2.2.1
├── iconv-lite@0.2.11
├── js-yaml@2.0.5 (argparse@0.1.16, esprima@1.0.4)
├── grunt-legacy-log@0.1.1 (underscore.string@2.3.3, lodash@2.4.1)
└── findup-sync@0.1.3 (glob@3.2.11, lodash@2.4.1)

grunt-wiredep@1.9.0 node_modules\grunt-wiredep
└── wiredep@1.8.6 (propprop@0.3.0, minimist@1.1.0, chalk@0.5.1, through2@0.6.3, glob@4.3.1, lodash@2.4.1, bower-config@0.5.2)

TFSService(运行命令的用户)是本地管理员。它必须立即工作,因为它由 CI Server 运行,因此不时需要完整的构建。

该项目由 yeoman 的 angular-generator 生成,package.json 文件如下所示:

{
     "name": "1",
     "version": "0.0.0",
     "dependencies": {},
     "devDependencies": {
       "grunt": "^0.4.1",
       "grunt-autoprefixer": "^0.7.3",
       "grunt-concurrent": "^0.5.0",
       "grunt-contrib-clean": "^0.5.0",
       "grunt-contrib-concat": "^0.4.0",
       "grunt-contrib-connect": "^0.7.1",
       "grunt-contrib-copy": "^0.5.0",
       "grunt-contrib-cssmin": "^0.9.0",
       "grunt-contrib-htmlmin": "^0.3.0",
       "grunt-contrib-imagemin": "^0.8.1",
       "grunt-contrib-jshint": "^0.10.0",
       "grunt-contrib-uglify": "^0.4.0",
       "grunt-contrib-watch": "^0.6.1",
       "grunt-filerev": "^0.2.1",
       "grunt-google-cdn": "^0.4.0",
       "grunt-newer": "^0.7.0",
       "grunt-ng-annotate": "^0.3.0",
       "grunt-svgmin": "^0.4.0",
       "grunt-usemin": "^2.1.1",
       "grunt-wiredep": "^1.7.0",
       "jshint-stylish": "^0.2.0",
       "load-grunt-tasks": "^0.4.0",
       "time-grunt": "^0.3.1"
     },
     "engines": {
       "node": ">=0.10.0"
     },
     "scripts": {
       "test": "grunt test"
     }
   }

如果我删除 grunt-contrib-imagemin 它可以工作

4

0 回答 0