Gulp Error Message "File not found" on MacOS - bash

I'm attempting to get Gulp up and running on MacOS 10.12.3. However, no matter what I do, I am getting the following error: No Gulp File Found.
I have done the following:
Installed gulp cli globally via sudo bash. Gulp version as of this writing is 3.9.1
Installed gulp locally via npm install gulp. Gulp version as of this writing is 3.9.1.
I've done the touch gulp command. This has created a 0kb blank gulp file.
I've created a test gulp.js file in my root directory. The code for said file looks likevar gulp = require('gulp');
Any thoughts on what's going on here?!

Your gulp file needs to be called gulpfile.js, not gulp.js.
While you're at it, I also recommend initializing npm by running npm init (it will walk you through it… just use all the defaults for now), and then adding gulp to your package.json by running npm install --save gulp. This will add
"dependencies": {
"gulp": "^3.9.1"
}
to your package.json.
What's the point of this? npm's package.json's "dependencies" becomes a list of all the gulp-related plugins your project needs. Any time you need to recreate the project, all you need is that package.json and you can run npm install to install them.
Note that even after renaming your file, you'll get the error
Task 'default' is not in your gulpfile
At the very least gulpfile.js will have to include the line gulp.task('default');… but if that's all your gulpfile has, you won't actually be doing anything with gulp.
I highly recommend working through css-trick's Gulp for Beginners - it doesn't take long, and you'll come out with a much more complete understanding of how to use gulp.

Related

Laravel Mix Sourcemaps with npm run dev

I´m compiling the SASS file with Laravel 8 mix:
// SASS/CSS files
mix.sass('resources/assets/scss/app.scss','public/assets/css')
.sourceMaps(false).version();
However, the .map file is only generated when I run npm run prod. If I run npm run dev, the .map isn´t created. Usually, it should be the other way around. Any idea what´s wrong with the configuration here?

sass : The term 'sass' is not recognized as the name of a cmdlet, function, script file, or operable program

I'm trying to get sass to run through the terminal and when I try, I get the error mentioned above. It seems that the installation of sass itself was successful because I can see it in my package.json file:
"devDependencies": {
"sass": "^1.51.0"
}
I have tried uninstalling/reinstalling sass, and restarting the client, but can't get the 'sass' keyword to work. I currently have my project located in a folder that github is also directed at so I can make pushing updates to github easier. Any help would be greatly appreciated.
Try npx sass, or create a new entry in the scripts section of your {package,yarn}.json file that calls sass.
"scripts": {
"build": "sass input.scss output.css",
}
Then, npm run build or yarn build, depending on which package manager you are using.
https://sass-lang.com/documentation/cli/dart-sass

why does npm gives me warning when i try to install jquery-csv library using VS in ubuntu

I'm trying to install jquery-csv library
with visual studio in ubuntu for the first time
the instruction says that to install package I should run:
npm i jquery-csv
however whenever I tried it npm warns me that it can't find package.son:
is this something i'm expected to see in a normal package installation?
if not, please help me with some instructions
The error you're getting suggests you aren't using a Node.js project and don't have a package.json file.
If this is an existing browser-based project and you want to add the library, you can download jquery.csv.min.js from here: https://github.com/typeiii/jquery-csv/tree/master/src , and add a client-side (browser) reference in your HTML file as shown on the readme:
<script src="jquery.csv.min.js"></script>
If you're working on a new Node.js project, the first step is to run npm init, see npm init - create a package.json file

How does yarn find a module installed as a dev-dependency

script object in the package.json files is the modern replacement for Gulp or a similar build tool. Assume that Vuepress is installed with yarn add -D vuepress (meaning that the vuepress is installed locally in the node_modules folder.
Further, assume that the package.json file contains the following script object:
"scripts": {
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs"
}
How does the command yarn docs:dev executed in the terminal resolve the vuepress object? More often than not a similar invocation results with the error vuepress not recognized ...
P.S. Since I do not have vuepress in the path environment variable the only place where it can be resolved is in the root level node_modules folder.
I guessed correctly - both npm and yarn (invoked from the terminal) have the ability to inspect all environment variables, as well as search the folder node_modules. In my concrete example, running the command
npm run env | grep scripts
results with
npm_config_ignore_scripts=
npm_config_scripts_prepend_node_path=warn-only
npm_package_scripts_docs_build=vuepress build docs
npm_package_scripts_docs_dev=vuepress dev docs
npm_package_scripts_env=env
There is a lot more information in the article https://techsparx.com/nodejs/tools/npm-build-scripts.html

--watch command is obsolete?

--watch command
no longer works for scss. What's the equivalent
Bought a new pc and can't get newest version of sass to compile
This is going to be marked as duplicate but please point me in right direction
No, I don't think so.
As the official SASS website explained, you can use --watch command like this:
sass --watch <input file or folder>:<output file or folder>
To install sass on your new machine you can use this command:
npm install -g sass

Resources