【问题标题】:Elixir Phoenix returns brunch.io errorElixir Phoenix 返回 brunch.io 错误
【发布时间】:2020-04-05 05:32:43
【问题描述】:

我正在尝试创建简单的 Phoenix 应用程序。当我运行mix phoenix.new my_app 时,我收到一个错误:

* running mix deps.get
* running npm install && node node_modules/brunch/bin/brunch build
* error command failed to execute, please run the following command again after installation: "npm install && node node_modules/brunch/bin/brunch build"

安装后运行上面的命令,又报错:

npm ERR! install Couldn't read dependencies
npm ERR! package.json ENOENT: no such file or directory, open '/home/agil/package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.

npm ERR! System Linux 
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/userme
npm ERR! node -v v4.6.1
npm ERR! npm -v 1.4.21
npm ERR! path /home/userme/package.json
npm ERR! syscall open
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -2
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/userme/npm-debug.log
npm ERR! not ok code 0

我不知道如何解决这个问题。我曾尝试使用--no-brunch 选项运行,但这对我没有帮助。如果您遇到这样的问题,如果您能分享您的经验,我将很高兴。

【问题讨论】:

  • 您是否在应用目录内部运行了命令?看来您正在 $HOME 上运行 npm
  • 不,我也在 my_app 目录中进行了测试。但没有帮助。
  • 您能否编辑您的帖子并显示该错误消息?这并不能帮助我们找出问题所在。
  • 对不起,伙计们。我想我解决了这个问题。我重新安装了一切。重新安装后,使用 --no-brunch 选项似乎不再出错。感谢大家阅读并回答我的问题。

标签: elixir phoenix-framework


【解决方案1】:

在 S/O 上还有其他一些地方出现了这个问题。但在发布之前最好检查的地方可能是项目 GitHub 页面上的问题。此页面提供了有关如何在无需重新安装所有内容的情况下解决问题的答案。遇到此错误后您会看到,您仍然可以运行您的应用程序;但是,它警告说,由于缺少早午餐,资产将无法编译。为了解决这个问题,您可以手动创建 assets 文件夹,在那里 cd,然后手动安装 brunch。所以从你的凤凰文件夹运行:

mkdir assets
cd assets
npm install && node node_modules/brunch/bin/brunch build

然后当你运行mix phoenix.server;您应该不会遇到任何错误,并且您的资产将被编译。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-07-24
    • 1970-01-01
    • 2015-12-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多