NPM提供的package.json抛出错误

我创build了一个NPM软件包并安装它进行testing。 使用npm install在嵌套的node_modules文件夹中npm install GruntJS的依赖关系时,NPM / Node会引发ENOENT错误。

我采取这些步骤来创build错误:

  • npm install pavilion
  • cd node_modules/pavilion
  • npm install

在安装Grunt的依赖关系时,列出在package.json中,它会抛出错误,如下所示。 PS。 请继续阅读下面。

 npm ERR! Darwin 14.5.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" npm ERR! node v5.0.0 npm ERR! npm v3.8.6 npm ERR! path /Users/Baasdesign/Desktop/test/node_modules/pavilion/node_modules/.staging/pavilion-8a19d0be npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall rename npm ERR! enoent ENOENT: no such file or directory, rename '/Users/Baasdesign/Desktop/test/node_modules/pavilion/node_modules/.staging/pavilion-8a19d0be' -> '/Users/Baasdesign/Desktop/test/node_modules/pavilion' npm ERR! enoent ENOENT: no such file or directory, rename '/Users/Baasdesign/Desktop/test/node_modules/pavilion/node_modules/.staging/pavilion-8a19d0be' -> '/Users/Baasdesign/Desktop/test/node_modules/pavilion' npm ERR! enoent This is most likely not a problem with npm itself npm ERR! enoent and is related to npm not being able to find a file. npm ERR! enoent npm ERR! Darwin 14.5.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" npm ERR! node v5.0.0 npm ERR! npm v3.8.6 npm ERR! path npm-debug.log.575049388 npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall open npm ERR! enoent ENOENT: no such file or directory, open 'npm-debug.log.575049388' npm ERR! enoent ENOENT: no such file or directory, open 'npm-debug.log.575049388' npm ERR! enoent This is most likely not a problem with npm itself npm ERR! enoent and is related to npm not being able to find a file. npm ERR! enoent npm ERR! Please include the following file with any support request: npm ERR! /Users/Baasdesign/Desktop/test/node_modules/pavilion/npm-debug.log 

现在怪异的部分。 当我使用鲍尔安装软件包…我不明白这个错误。 这是我的步骤:

  • bower install pavilion
  • cd bower_components/pavilion
  • npm install

一切都安装好。 区别? —> package.json。 bower install package.json可以find。 NPM的不是。

鲍尔给了我一个干净的package.json,由我自己在发布到npm之前创build。 NPM安装给了我一个package.json,里面有更多的信息。 当我使用bower package.json …一切安装正常…甚至当我粘贴并replacenode_modules文件夹中的npm package.json。

这里的交易是什么? 看来,随npm安装提供的package.json会扰乱依赖安装。

这里是凉亭package.json传递: http : //pastebin.com/g8FgSDNG

这里是npm package.json传递: http : //pastebin.com/xTiQ15ih

我已经尝试npm cache clean但没有奏效。

SYSINFO:

  • OSX优胜美地
  • 节点 – 5.10.1
  • npm – 3.8.6

节点是辉煌的,但有时会是一个痛苦!

我最近自己有这个错误,并且回滚到早期版本的节点修复了我的问题。

我build议你尝试一下以前的安装,你可以使用“节点版本pipe理器”在你的系统上有几个节点版本,它提供了在不同版本之间切换的方法。

我知道它不是一个非常技术性的答案,我希望有人对你的问题有一个具体的答案!

[ https://github.com/creationix/nvm%5D

这是版本pipe理链接,希望它有帮助

问题是我没有保存package.json中的依赖项。 如果你这样做,我猜Node会得到错误的path。

所以正确的工作stream程是:

  • npm init (创buildpackage.json)
  • npm install <package> --save-dev
  • cd node_modules/pavilion
  • npm install

然后它工作正常。 需要将<package>添加到父目录的package.json中。