npm运行构建错误,没有这样的文件或目录,打开'build/bundle.css'
问题描述:
我正在尝试在node package-manager支持的本地主机生产上定制的WordPress安装的例行测试。在实例化WordPress核心文件后,确保成功连接到数据库并更新了一些资源,我试图将目录更改为相应的WordPress主题文件以运行npm install
(成功)的node-package-manager安装命令,然后按照例行程序尝试执行带有npm run build
的CSS编译器;然而,在这样的尝试,我遇到了我下面的终端输出中的以下错误:npm运行构建错误,没有这样的文件或目录,打开'build/bundle.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
不用说,上面的错误排除从任何渲染网页本地主机,但我可以成功访问和WordPress的内容管理系统中进行浏览。我将不胜感激任何指导 - 谢谢!
答
在调查Google Chrome Inspector工具控制台中的本地主机制作之后,错误报告说整个node package-manager folder and dependencies都丢失了。由于npm-install
和npm build
都没有实例化包文件夹或依赖关系,所以我只是复制了我的其他工作本地主机产品中的文件,特别是bundle.css,它显然从适当的路径中缺失(wp/themes/vetsi/build)。现在,这种攻击是解决我的问题的最佳方案,但我欢迎替代分析或澄清为什么上述命令根据我以前的成功没有正确执行。谢谢!