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
Related
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?
I'm encountering a problem with the npm install step during my CI/CD build in Azure DevOps.
The specific package that is causing this problem appears to be node-sass. This package has given me a lot of trouble in the past as well but I did get it working and builds have been running fine for a while. Now for some reason they are failing again but I cannot seem to reproduce the problem on my machine and the error doesn't make any sense to me.
Here is the output from the failed build: https://pastebin.com/w4aK4dEh.
The error message is "Error: Cannot find module './version'"
I have tried to modify the step and changed it from a simple npm install to npm install --save-dev --unsafe-perm but it didn't seem to have any effect.
package.json
{
"version": "1.0.0",
"name": "myproject",
"private": true,
"devDependencies": {
"gulp": "4.0.2",
"gulp-concat": "2.6.1",
"gulp-cssmin": "0.2.0",
"gulp-rename": "2.0.0",
"gulp-sass": "4.1.0",
"gulp-uglify": "3.0.2",
"rimraf": "3.0.2",
"node-sass": "^4.8.3"
},
"dependencies": {}
}
I have also tried to remove node-sass from the dependencies entirely because I thought gulp-sass already includes it by default, but then I ran into "module node-sass not found" errors.
I'm really stumped on this one. Any suggestions would be appreciated.
I am not entirely sure which of the following was the key to success but here's what I did to resolve this:
Delete the node_modules folder from my project, commit and then modify my .gitignore to exclude it from the repository permanently (yes, I know this one is a bit controversial as some people say the folder should be checked in)
Update the versions of the dependencies in the package.json file
Specify the specific version of NodeJs (and thus npm) to use. I did this by simply adding a step in the Azure build pipeline. Interestingly, the very latest version (15.2.1 at the time of writing this) did not work, however the LTS version 14.15.1 did work.
Some combination of those three changes did resolve the problem for me. I am leaving this information here in case someone else faces this same error message.
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.
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');
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