I am new to gulp but on a existing laravel project I needed to add some css I was told to update the app.sass and then run gulp to compile it. I tried to follow a guide called Compiling Assets (Laravel Elixir) to compile the sass file but ran into problems. To get everything installed correctly I updated our bootstrap.sh file in the vagrant setup to include nodejs, npm, gulp and laravel-elixir. Once the changes were made I loaded the vagrant box and I verified that I have the following versions.
[vagrant#localhost project-css]$ gulp -v
[18:12:38] CLI version 1.4.0
[18:12:38] Local version 3.9.1
[vagrant#localhost project-css]$ npm -v
3.10.10
[vagrant#localhost project-css]$ node -v
v6.11.1
When I try to run gulp I get
/vagrant/src/project-css/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:349
if (n <= 0 || state.length === 0 && state.end
SyntaxError: Invalid or unexpected token
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/vagrant/src/project-css/node_modules/through2/node_modules/readable-stream/readable.js:12:30)
The full project I'm working on is available on github at Rockefeller-css
Any suggestions would be appreciated.
I was able to resolve the issue on my own by adding the following to my bootstrap.sh file
rpm -ivh https://kojipkgs.fedoraproject.org//packages/http-parser/2.7.1/3.el7/x86_64/http-parser-2.7.1-3.el7.x86_64.rpm
yum install -y nodejs
Also after vagrant was finished loading and I was able to ssh into the box in a custom setup-vagrant.sh script that needed to be ran I was able to add the following command.
sudo npm install
Their was already a cd into the laravel project folder and their was a package.json file that existed. After that I was able to cd into the project folder and run gulp correctly.
Trying to get code running from my groups repo.... everyone elses seems to install and run fine, but my setup is having issues. Not sure if this is a dependency issue or not.
Tried removing node / npm / nvm and reinstalling everything including code from repo. Still having issues...
React : 0.14.8
react-native-cli: 0.2.0
react-native: 0.24.0
also react-native-cli was installed globally
with npm install -g react-native-cli
command after install : react-native run-ios
getting
/node_modules/react-native/Libraries/react-native/react-native.js:121
...require('React'),
^^^
SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:414:25)
at Module._extensions..js (module.js:442:10)
at Object.require.extensions.(anonymous function) as .js
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at
node_modules/react-native/node_modules/babel-core/lib/transformation/file/options/option-manager.js:409:22
at Array.map (native)
In npm#3 subDependencies are installed at the same level of your project dependencies (./node_modules). My guess is the project is missing some dependencies to run the packager. If you haven't already done so, updgrade to npm#3 ($ npm install -g npm), delete your node_modules folder, then try again.
$ rm -rf node_modules && npm install
When I compile with gulp, I got an error like below. How can I fix it?
module.js:339
throw err;
^
Error: Cannot find module 'gulp-sass'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/Applications/XAMPP/xamppfiles/htdocs/flyscoot.com/gulpfile.js:2:12)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
Just do npm update and then npm install gulp-sass --save-dev in your root folder, and then when you run you shouldn't have any issues.
Edit your package.json. Change:
"gulp-sass": "^2.3.2"
to
"gulp-sass": "3.0.0"
Delete the node_modules folder and run npm install again.
Source: https://github.com/codecombat/codecombat/issues/4430#issuecomment-348927771
Did you check this question?
May be possible solution is:
rm -rf node_modules/
npm install
I had the same problem, and I resolve doing this npm update. But I receive the message about permission, so I run:
sudo chwon -R myuser /home/myUserFolder/.config
This set permissions for my user run npm comands like administrator. Then I run this again:
npm update
and this:
npm install gulp-sass
Then my problem with this was solved.
Try this:
npm install -g gulp-sass
or
npm install --save gulp-sass
I had the same problem on my new Windows 10 machine. I had to intall the Windows build tools with npm install -g windows-build-tools. (https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#environment-setup-and-configuration)
i was also facing the same issue,
The possible solution is to install the gulp-sass module, but if you will run the below command npm install -g gulp-sass or npm install --save gulp-sass, This is not going to be updated on node-sass project's end.
This version of node-sass is missing (returns a 404) and google web-starter-kit v0.6.5 has depended on it for a long time, since Dec 2016. So, it has been working for a long time and must have just disappeared.
Downloading binary from
https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node
Cannot download
"https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node":
HTTP error 404 Not Found
The only workaround is to upgrade node-sass:
npm i gulp-sass#latest --save-dev to fix the issue.
I had same error on Ubuntu 18.04
Delete your node_modules folder and run
sudo npm install --unsafe-perm=true
Make sure python is installed on your machine, Python is required for node-sass.
I had this issue for days looking for answers. My error log was similar to this npm just won't install node sass
The only problem was the node version. Maybe it can help some of you.
I downgraded my Node.js from 9.3.0 to 6.12.2 and run:
npm update
In the root folder where package.json is located, run npm outdated. You'll get outdated packages returned with some details. In those details, you'll see the current version number of the outdated package.
After then, open the package.json file and manually change the version number of the corresponding package.
Then delete the node_modules folder and run npm install. It should solve this issue.
I ran : npm i gulp-sass#latest --save-dev
That did the magic for me
Ive faced the same troubles with gulp-sass in my VSCode environment.
Also, I was observing a lot of fails during npm installing and I could not start gulp (as outcome).
The way how I fixed it:
delete packages
npm i
npm i gulp-sass --save-dev
Now it works.
Those who are getting this error, please downgrade the Node.js you are using.
Step 1 :
Uninstall the one you are using and install the version you prefer. I installed v6.12.3. My previous Node.js version was v9.4.0.
Step 2 :
Download Node.js.
Hope this will work.
I worked with Yarn and I got the same issue and I solve it doing this:
delete node_modules
yarn install
yarn upgrade
yarn install gulp-sass --save-dev
Try this to fix the error:
Delete node_modules directory.
Run npm i gulp-sass#latest --save-dev
Solution:
const sass = require('gulp-sass')(require('sass'));
npm install gulp-sass sass
I installed a new distro (Elementary OS 0.3 Freya 64 bits) on my PC and setting up my workflow I'm having a problem running the gulp-sass package. When I run the gulp command it return the error:
$ gulp
[10:26:06] Using file /var/www/html/projects/avanteweb.github.io/gulpfile.js
[10:26:06] Working directory changed to /var/www/html/projects/avanteweb.github.io
/var/www/html/projects/avanteweb.github.io/node_modules/gulp-sass/node_modules/node-sass/lib/index.js:22
throw new Error('`libsass` bindings not found. Try reinstalling `node-sass
^
Error: `libsass` bindings not found. Try reinstalling `node-sass`?
at getBinding (/var/www/html/projects/avanteweb.github.io/node_modules/gulp-sass/node_modules/node-sass/lib/index.js:22:11)
at Object.<anonymous> (/var/www/html/projects/avanteweb.github.io/node_modules/gulp-sass/node_modules/node-sass/lib/index.js:188:23)
at Module._compile (module.js:462:26)
at Object.Module._extensions..js (module.js:480:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:367:17)
at require (module.js:386:17)
at Object.<anonymous> (/var/www/html/projects/avanteweb.github.io/node_modules/gulp-sass/index.js:3:17)
at Module._compile (module.js:462:26)
I tried the answers on Try reinstalling node-sass on node 0.12? but it's still not working. How can I fix this issue?
Reading from other threads, this might work for you:
$ npm uninstall gulp-sass node-sass
$ npm install node-sass#1.0.3 # using an older version of node-sass
$ npm install gulp-sass
References:
Try reinstalling node-sass on node 0.12?
Install fails - Windows 2008 - Error: libsass bindings not found. Try reinstalling node-sass?
libsass bindings not found error on v1.3.1, v1.3.2
I have installed node.js v0.8.8 both from the pkg installer and compiled from source. Yet I get the following error when trying to run npm. Any help would be appreciated.
> $ npm --help
>
> /usr/lib/node_modules/npm/lib/utils/config-defs.js:5 , stdio =
> process.binding("stdio")
> ^ Error: No such module
> at Object.<anonymous> (/usr/lib/node_modules/npm/lib/utils/config-defs.js:5:21)
> at Module._compile (module.js:449:26)
> at Object.Module._extensions..js (module.js:467:10)
> at Module.load (module.js:356:32)
> at Function.Module._load (module.js:312:12)
> at Module.require (module.js:362:17)
> at require (module.js:378:17)
> at Object.<anonymous> (/usr/lib/node_modules/npm/lib/utils/ini.js:43:18)
> at Module._compile (module.js:449:26)
> at Object.Module._extensions..js (module.js:467:10)
I had the exact same issue upgrading from Node.JS 0.4 to 0.8. What worked for me was the following:
The OSX Node.JS package installer erroneously does not remove the old 0.4 npm installation in /usr/bin, which then conflicts with the new 0.8 one in /usr/local/bin. It just overwrites whatever is there already. I nuked the old one by deleting it, but to make sure, I decided a clean install would be better:
curl https://npmjs.org/install.sh | sudo clean=yes sh
There was one last problem: after the install, even though a which npm correctly returns /usr/local/bin/npm, bash kept trying to execute from /usr/bin. This is because on OSX, bash has hashed the executable name. The hashing saves repeated searches of all directories in your PATH every time you execute common programs. A hash -r at the command line took care of this issue.
You are most likely using an old NPM version somehow.
see: npm issue