我尝试在node package-manager支持的本地主机制作上对自定义WordPress安装进行例行测试。在实例化WordPress核心文件,确保成功连接到数据库并更新一些资产之后,我尝试将目录更改为相应的WordPress主题文件,以使用npm install
运行node-package-manager install命令(这是成功的)然后尝试按照例程用npm run build
执行CSS编译器;但是,在这次尝试中,我在下面的终端输出中遇到了以下错误:
vetsi npm run build
> @ build /Users/alexsingleton/Sites/vetsi/wp-content/themes/vetsi
> npm-run-all --silent compile:css compile:js
/Users/alexsingleton/Sites/vetsi/wp-content/themes/vetsi/node_modules/stylus/bin/stylus:715
if (err) throw err;
^
Error: ENOENT: no such file or directory, open 'build/bundle.css'
at Error (native)
ERROR: compile:css: None-Zero Exit(1);
npm ERR! Darwin 16.4.0
npm ERR! argv "/Users/alexsingleton/.nvm/versions/node/v4.4.4/bin/node" "/Users/alexsingleton/.nvm/versions/node/v4.4.4/bin/npm" "run" "build"
npm ERR! node v4.4.4
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ build: `npm-run-all --silent compile:css compile:js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ build script 'npm-run-all --silent compile:css compile:js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm-run-all --silent compile:css compile:js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/alexsingleton/.npm/_logs/2017-02-15T17_48_20_907Z-debug.log
➜ vetsi
我已尝试使用npm install -g npm
更新节点包管理器并验证与nvm ls
生成以下输出的另一个成功本地主机生产相对应的正确版本:
vetsi nvm ls
v0.12.7
-> v4.4.4
system
default -> 4.4.4 (-> v4.4.4)
node -> stable (-> v4.4.4) (default)
stable -> 4.4 (-> v4.4.4) (default)
iojs -> iojs- (-> N/A) (default)
➜ vetsi
毋庸置疑,上述错误会阻止任何localhost页面呈现,但我可以在WordPress内容管理系统中成功访问和导航。我很感激任何指导 - 谢谢!
答案 0 :(得分:0)
在调查Google Chrome Inspector工具控制台中的localhost-production后,错误报告错过了整个node package-manager folder and dependencies。由于npm-install
和npm build
都没有实例化包文件夹或依赖项,我只是从我的其他工作localhost生成中复制文件,特别是 bundle.css ,其中它显然是从适当的路径中遗漏的( wp / themes / vetsi / build )。目前,这个hack是我问题的最佳解决方案,但我欢迎另外的分析或澄清为什么上述命令根据我以前的成功没有正确执行。谢谢!