Laravel、长生不老药和吞咽
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33052019/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel, elixir and gulp
提问by user2301515
I've gulpfile.js with content
我有 gulpfile.js 的内容
var gulp = require('gulp');//this is working
gulp.task('default', function() { });//this is working
var elixir = require('laravel-elixir');//this is NOT working
Running "gulp" in cmd I get a message:
在 cmd 中运行“gulp”我收到一条消息:
C:\myaccount\workspace\todoparrot>gulp
module.js:338
throw err;
^
Error: Cannot find module 'lodash._baseclone'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (C:\myaccount\workspace\todoparrot\node_modules\laravel-elixir\node_modules\gulp-notify\node_modules\node-notifier\node_modules\lodash.clonedeep\index.js:9:17)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
command gulp is working, but how to set the elixir to work, that gulp is working on it. What is laravel/elixir proper version for writing to file composer.js require {..,"laravel/elixir":"???????",..}. Is it "laravel/elixir" or "laravel-elixir". I'm unable to find sufficient good instructions.
命令 gulp 正在运行,但是如何设置长生不老药起作用,那个 gulp 正在处理它。什么是用于写入文件 composer.js require {..,"laravel/elixir":"???????",..} 的 laravel/elixir 正确版本。是“laravel/elixir”还是“laravel-elixir”。我找不到足够好的说明。
采纳答案by Jimmy Obonyo Abor
Sometimes npm install
fails to install packages due to your machine ram spec or services runing in server , try installing bit by bit the laravel-elixir package dependency in your package.json file then finish by adding the elixir package at the bottom of the file as in below :
有时npm install
由于您的机器内存规格或在服务器中运行的服务而无法安装软件包,请尝试在 package.json 文件中一点一点地安装 laravel-elixir 软件包依赖项,然后通过在文件底部添加 elixir 软件包来完成,如下所示:
{
"private": true,
"devDependencies": {
"gulp": "^3.8.8"
},
"dependencies": {
"babelify": "^7.2.0",
"browser-sync": "^2.7.10",
"browserify": "^11.2.0",
"del": "^1.2.0",
"glob": "^5.0.14",
"gulp-autoprefixer": "^2.3.1",
"gulp-babel": "^6.1.0",
"babel-preset-es2015": "^6.1.0",
"babel-preset-react": "^6.1.18",
"gulp-batch": "^1.0.5",
"gulp-coffee": "^2.3.1",
"gulp-concat": "^2.6.0",
"gulp-if": "^1.2.5",
"gulp-less": "^3.0.3"
}
}
ADD ALL DEPENDENCIES BIT BY BIT AS IN THIS FILE https://github.com/laravel/elixir/blob/master/package.jsonONCE ALL DEPENCIES HAVE INSTALLED ADD
在此文件中一点一点地添加所有依赖项https://github.com/laravel/elixir/blob/master/package.json一旦所有依赖项都已安装添加
"laravel-elixir": "^4.0.0"
AT THE BOTTOM AND RUN npm install
, this should install elixir and all dependencies
AT THE BOTTOM AND RUN npm install
,这应该安装 elixir 和所有依赖项
回答by Tim Sheehan
Try running "npm install" first to install dependencies.
首先尝试运行“npm install”来安装依赖项。
回答by Benjamin Chika
if you read the error message properly it implies that in laravels bid to contact a file in the node-module/ path it encountered an error best solution is to locate such a file and make adjustment to all references made to its "name". I encountered the same issusewhen try to run larvel-elixir, problem came out to be "laravel-elix/" was referenced wrongly in my gulfile.js. Relax and try again
如果您正确阅读了错误消息,则意味着在 laravel 中要联系节点模块/路径中的文件时遇到错误,最佳解决方案是找到这样的文件并对其“名称”的所有引用进行调整。我 在尝试运行 larvel-elixir 时遇到了同样的问题,问题是在我的 gulfile.js 中错误地引用了“laravel-elix/”。放松并重试