在生产中使用带有--force的npm安装是否安全?

时间:2016-04-13 13:08:52

标签: node.js npm install npm-install

我们在构建服务器中面临一个有趣的问题,它阻止我们的应用程序安装npm依赖项,这会导致我们的大多数构建失败。

我们正在使用运行Windows的构建服务器 Visual Studio Team Services 。当我们尝试安装npm依赖项时,我们收到以下错误:

    2016-04-13T12:44:25.0931743Z npm ERR! Windows_NT 6.3.9600
    2016-04-13T12:44:25.0931743Z npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--production"
    2016-04-13T12:44:25.0941742Z npm ERR! node v0.12.7
    2016-04-13T12:44:25.0941742Z npm ERR! npm  v2.11.3
    2016-04-13T12:44:25.0951737Z npm ERR! path C:\NPM\Cache\repeating\1.1.3\package\package.json
    2016-04-13T12:44:25.0951737Z npm ERR! code EPERM
    2016-04-13T12:44:25.0951737Z npm ERR! errno -4048
    2016-04-13T12:44:25.0981746Z npm ERR! Error: EPERM, rename 'C:\NPM\Cache\repeating\1.1.3\package\package.json'
    2016-04-13T12:44:25.0991748Z npm ERR!     at Error (native)
    2016-04-13T12:44:25.0991748Z npm ERR!  { [Error: EPERM, rename 'C:\NPM\Cache\repeating\1.1.3\package\package.json']
    2016-04-13T12:44:25.1001741Z npm ERR!   errno: -4048,
    2016-04-13T12:44:25.1001741Z npm ERR!   code: 'EPERM',
    2016-04-13T12:44:25.1011746Z npm ERR!   path: 'C:\\NPM\\Cache\\repeating\\1.1.3\\package\\package.json',
    2016-04-13T12:44:25.1011746Z npm ERR!   parent: 'babel-traverse' }
    2016-04-13T12:44:25.1021741Z npm ERR! 
    2016-04-13T12:44:25.1021741Z npm ERR! Please try running this command again as root/Administrator.
    2016-04-13T12:44:28.0020021Z npm ERR! Please include the following file with any support request:
    2016-04-13T12:44:28.0029943Z npm ERR!     C:\a\1\s\src\OrderEze.Web\npm-debug.log
    2016-04-13T12:44:28.1069958Z ##[debug]rc:4294963248
    2016-04-13T12:44:28.1079955Z Npm failed with error: C:\Program Files\nodejs\npm.cmd failed with return code: 4294963248

我们发现如果我们尝试使用force命令安装我们的依赖项,一切正常:

npm install --force

我的问题很简单。我们对此配置有任何问题吗?为什么npm警告我们这个命令?任何想法都可以帮助:)

0 个答案:

没有答案