Laravel elixir not found when running gulp in cli - node.js

It has been pretty frustrating finding the solution to this problem today, as I've tried searching on Google and went to all of different forums and websites in search of a solution, but none of them worked for me.
Is there anyone who could tell me what I could try in order to solve this?
Facts:
Fresh Laravel installation
Ran npm install
Ran npm install gulp
Ran gulp
Got this error
package.json contents
{
"private": true,
"devDependencies": {
"gulp": "^3.8.8"
},
"dependencies": {
"laravel-elixir": "^4.0.0",
"bootstrap-sass": "^3.0.0"
}
}

try to remove the node_modules directory completely and issue npm install or npm install --no-bin-links without gulp, gulp should already included in packages.json

Very old question I know, but, if still having issue...
Try to run
npm install laravel-elixir --save-dev
command manually on prompt.
And then make sure you added following code line in gulpfile.js file
var elixir = require('laravel-elixir');

Related

npm install stuck on "checking installable status"?

I have recently updated a project where the last udpate was about a month ago, but failed to deploy to the server. After some investigation, it is because it is stuck in npm install, or more precisely, stuck at a line saying
This sutck happens on different package when trying on different machine, so it seems to be related to npm instead of any package.
I have made no changes to the package.json, only on some other javascript files. Also, the last deploy was about a month ago. In other words, the npm install can be run without problem last month.
This problem can be replicated by copying the package.json file to an empty folder and run npm install. The package.json file:
{
"private": true,
"devDependencies": {
"gulp": "^3.9.1",
"laravel-elixir": "^6.0.0-14",
"laravel-elixir-webpack-official": "^1.0.2",
"node-sass": "^4.5.3"
},
"dependencies": {
"eventemitter3": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.2.0.tgz"
}
}
I am using node 11.15.0, npm 6.7.0 through nvm. As it is a running project on live, upgrading or downgrading node and npm version is not an option without some careful planning, and seems to be an overkill at the moment.
For reference, I noticed that there is an outage in npmjs registory recently, but it seems to be fixed, so I am not sure if it is related. Have anyone had similar problem recently? Or any suggestion on how to solve this problem?

Gulpfile not found even though it clearly exists

I'm trying to help a remote coworker install gulp on Windows so he can compile one of our JavaScript projects locally. An employee before me has been trying to help this remote coworker for over a year before I got here to little avail, so there may be some crud left over from that time at the root of the issue, but I've done what I thought to be a reasonable start from scratch and I continue to have the same problem.
I've sent him the project folder exactly cloned as I have it, minus the node_modules folder. I had him uninstall and reinstall Node first using the first three steps of this answer followed by redownloading the MSI from NodeJS.org to reinstall fresh. Then, in the working directory, I had him run
PS C:\Users\Coworker\Path\To\Project>npm ci
to install gulp. gulp and its various extensions are the only modules in the package.json folder, and the package-lock.json is simply the result of us successfully installing these packages recently. Contents of package.json:
{
"devDependencies": {
"gulp": "^4.0.0",
"gulp-coffee": "latest",
"gulp-concat": "latest",
"gulp-concat-sourcemap": "latest",
"gulp-connect": "latest",
"gulp-minifier": "latest",
"gulp-minify-css": "latest",
"gulp-remove-logging": "latest",
"gulp-resolve-dependencies": "latest",
"gulp-sass": "latest",
"gulp-uglify": "latest",
"gulp-util": "latest",
"gulp-watch": "latest",
"gulp-wrap": "latest"
},
"dependencies": {
"natives": "^1.1.6"
}
}
I also had him uninstall and reinstall gulp-cli globally.
npm uninstall --global gulp gulp-cli
npm install --global gulp-cli
Running gulp --version displays the correct, expected output:
PS C:\Users\Coworker\Path\To\Project>gulp --version
CLI version: 2.2.0
Local version: 4.0.0
This matches the output on my Windows machine, where everything works fine.
When we finally have him run gulp in the project directory, it simply gives:
PS C:\Users\Coworker\Path\To\Project> gulp
No gulpfile found
The only helpful question already on Stack Overflow for this is here, and every answer there is some form of "add a gulpfile". But there is a gulpfile.js in the working directory. It has the correct name and file extension. It is formatted properly. It's an exact duplicate of the file in my own local directory, which when I run the same command, it gulps flawlessly. What could be causing gulp to not recognize the gulpfile is present? Could gulp be misconfigured and trying to run with a different working directory, despite the directory it is being called in? How can I troubleshoot this?
Try explicitly specifying the gulpfile:
gulp --gulpfile gulpfile.js
gulp --gulpfile C:\Users\Coworker\Project\gulpfile.js

Can't install laravel-elixir because of node-sass failure

I am pretty new to this environment still and am trying to get up to speed on node.js modules and Laravel (5.1.11) as a whole, so...
I have a fresh install of Laravel implemented by the cPanel Installitron. I'm using PHPStorm to install all of the node modules via the provided package.json:
package.json
{
"private": true,
"devDependencies": {
"gulp": "^3.8.8"
},
"dependencies": {
"laravel-elixir": "^3.0.0",
"bootstrap-sass": "^3.0.0"
}
}
The error I get when I run the install is:
Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node":
HTTP error 404 Not Found
I can understand why this would happen, seeing as that is an older version of node-sass, but how do I know what newer versions are compatible with the requested version of laravel-elixir? I didn't want to just install a newer version of node-sass because digging a deeper hole would make it harder for me to find a solution to my problem. What is the fix for this?
It looks like you can fix this by installing Windows Build Tools via this command:
npm install --global --production windows-build-tools
Then delete the project's node_modules folder and re-run npm install.
Just follow this official url well doc.: https://laravel.com/docs/5.3/elixir if you get any error. I just comment and i ll be here.

Unable to resolve module `react/lib/ReactComponentTreeHook`

I'm attempting to upgrade React Native and I'm running into the following:
error: bundling: UnableToResolveError: Unable to resolve module `react/lib/ReactComponentTreeHook` from `/Users/anthony/dev/apptova-react/node_modules/react-native/Libraries/Performance/Systrace.js`: Module does not exist in the module map or in these directories:
/Users/anthony/dev/apptova-react/node_modules/react-native/node_modules/react/lib
, /Users/anthony/dev/apptova-react/node_modules/react/lib
I'm so confused. I can't find any library named ReactComponentTreeHook in node_modules, anywhere.
I've tried removing the node_modules folder and reinstalling, nada. I've also cleared watchman watches and reset the packager cache.
EDIT: I kept running into issues that seemed to stem from react-native-maps so I so I reset back to a working stable version, uninstalled react-native-maps, and ran react-native-git-upgrade (again).
Now I'm getting:
error: bundling: UnableToResolveError: Unable to resolve module `react/lib/ReactDebugCurrentFrame` from `/Users/anthony/dev/apptova-react/node_modules/react-native/Libraries/Renderer/src/renderers/shared/stack/reconciler/ReactCompositeComponent.js`: Module does not exist in the module map or in these directories:
/Users/anthony/dev/apptova-react/node_modules/react-native/node_modules/react/lib
, /Users/anthony/dev/apptova-react/node_modules/react/lib
I'm just trying to latest, my package.json dependencies are simple so I don't think its conflicts with a third-party code base:
"dependencies": {
"react": "15.4.1",
"react-native": "^0.43.1",
"react-native-drawer": "^2.3.0"
},
"devDependencies": {
"babel-jest": "18.0.0",
"babel-plugin-transform-flow-strip-types": "^6.21.0",
"babel-preset-react-native": "1.9.1",
"deepmerge": "^1.3.2",
"flow-bin": "^0.37.4",
"jest": "18.0.0",
"react-test-renderer": "15.4.1"
},
Again, went throught the process of clearing watchman watches, node modules, reseting package manager and still get this error.
EDIT 2: After spending two solid days of trying to get this working I created a new blank project and migrated my code over.
Make sure version in your package.json file is the version you want.
For example, "react-native: ^0.43.3" is not same as "react-native: 0.43.3".
Clean up and re-install everything.
If the error still there, then try to install react-native-git-upgrade
$ npm install -g react-native-git-upgrade
and then run
$ react-native-git-upgrade x.y.z(version you want to upgrade to)
for me it works.
If your version is too old, then you should follow the old version document to upgrade.
This could also happen if you don't have the correct version of react required by the version of react-native. If this is the case, you would get a warning like this when you run npm install.
npm WARN react-native#0.43.4 requires a peer of react#16.0.0-alpha.6 but none was installed.
To fix this problem, stop the react packager and upgrade the version of react by running the following command
npm install -save react#16.0.0-alpha.6
Now, re-run the app and hopefully the issue would go away.
I think recently many of the modules under react/lib were moved to react-dom/lib, which is why the packager can't find some modules
I followed following steps and it's working
• Deleted node_modules folder
• Replaced ^16.0.0-alpha.6 with "react": "16.0.0-alpha.3"
• npm install
• react-native run-android

Uncaught ReferenceError: angular is not defined - Mean.IO

I have followed the steps to install mean.io, but when I browse the localhost:3000 I get a blank page and when I open the console I get a list of files pointing to the same error:
Uncaught ReferenceError: angular is not defined
my issue is something similar to this, but I re-installed bower and it didn't work I'm still getting the error.
I'm trying to install this in ubuntu 14.04
this is the screen I get:
Do I need to perform some sort of modification to any script, file reference or configuration, any suggestions?
I had the same problem and I solved in this way:
You need to install or reinstall "bower"
Check your bower.json file, it should look something like this:
{
"name": "mean",
"version": "0.3.0",
"dependencies": {
"angular": "latest",
"angular-resource": "latest",
"angular-cookies": "latest",
"angular-mocks": "latest",
"angular-route": "latest",
"bootstrap": "latest",
"angular-bootstrap": "0.10.0",
"angular-ui-router": "#master"
}
}
and then run the following command:
  sudo bower install --allow-root
This will install to "Angular" in the project
I had the same problem but for some reason the top answer here (reinstalling bower and running sudo bower install --allow-root) didn't work for me.
However the answer form this stackoverflow thread worked -> bower command not found Basically the author there said I wasn't setting npm prefix properly and to fix that the following was required:
$ npm config set prefix /usr/local
$ npm install -g bower
note the it is bad form to install mean.io as root and as a result run bower or npm as root.
We actually built processes into mean-clithat will disallow running as root.
Running as root is the sure way to expose mean to more serious security issues and to "contaminating" you .npm and .bower caches with a mix of normal and root based permissions which is very frustrating for "newbies"
If you are behind the proxy, then still problem not solved. So in order to solve it you need to include proxy-setting in .bowerrc file as
{
"directory": "public/lib",
"proxy":"http://user:passwd#server:port",
"https-proxy":"http://user:passwd#server:port"
}
Now run
sudo npm install -g bower
sudo bower install --allow-root

Resources