我正在尝试创建简单的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选项运行,但对我没有帮助。如果你遇到这样的问题,如果你能分享你的经验,我会很高兴。
发布于 2017-05-28 04:55:18
在S/O上还有其他一些地方也出现了这个问题。但在发布之前最好的检查可能是在项目的GitHub页面上的一个问题。此页提供了如何在不需要重新安装所有内容的情况下解决问题的答案。你会发现在你遇到这个错误后,你仍然可以运行你的应用程序;但是,它警告说,由于缺少早午餐,资源将无法编译。为了解决这个问题,您可以手动创建assets文件夹cd,然后手动安装brunch。因此,从您的phoenix文件夹运行:
mkdir assets
cd assets
npm install && node node_modules/brunch/bin/brunch build然后,当您运行mix phoenix.server时,您应该不会遇到任何错误,您的资源将被编译。
https://stackoverflow.com/questions/41381652
复制相似问题