【问题标题】:npm install of Next.js from github fails从 github 安装 Next.js 的 npm 失败
【发布时间】:2017-01-29 16:58:42
【问题描述】:

当尝试从 Github 直接 npm install zeit/nextjs 时,它会失败并出现以下异常。

在 docker 实例和直接在 osx 中运行时,以及在节点 5.2 和 7.2 上运行时,我都会遇到相同的错误。第一次直接从Github安装,不知道是不是漏掉了什么重要的东西?

编辑

npm install next

按预期工作,但不包含 Docker 所需的最新 package.json

结束编辑

问候 马蒂亚斯

root@2cc7a4204924:/usr/src# npm install git+https://github.com/zeit/next.js
.
.
.
.... lots of other packages installing fine .....
.
.
.
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "git+https://github.com/zeit/next.js"
npm ERR! node v7.2.0
npm ERR! npm  v3.10.9
npm ERR! path /usr/src/node_modules/next/dist/bin/next
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod

npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/src/node_modules/next/dist/bin/next'
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/src/node_modules/next/dist/bin/next'
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!     /usr/src/npm-debug.log

【问题讨论】:

    标签: node.js github npm next.js


    【解决方案1】:

    不确定为什么它在 github 上不起作用,但您可以这样做以从 npm 安装最新的 beta:

    npm i --save next@^2.0.0-beta
    

    【讨论】:

      【解决方案2】:

      按名称安装软件包可以正常安装,但通过 github 会引发错误。应该是Github当前版本的问题。

      npm i next          // works
      npm i zeit/next.js  // doesn't work
      

      【讨论】:

      • 是的,我应该补充一下。但我需要github上的版本,因为它解决了我的依赖包github.com/zeit/next.js/issues/344的问题
      • 您目前正在运行哪个版本的 Next?我刚刚安装了它,版本是 next@1.2.3 。如果你有较低的版本,你可以更新它。
      • Nextjs@1.2.3 在 docker 内(或者我猜在任何 Linux 主机上)无法工作,因为使用的 is-windows-bash 版本存在问题(请参阅参考资料 github 问题) .对此的修复已合并到 GitHub 中,这就是我尝试从 github 而不是 npm 存储库安装的原因。
      • 是的,我明白了。我只是想确保您拥有最新版本。
      • 我检查了 repo,刚刚在 Github 上找到了你的问题。希望有人可以提供帮助。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-04
      • 2012-12-07
      • 1970-01-01
      相关资源
      最近更新 更多