this is a gruntfile.json
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
imagemin: {
options: {
optimizationLevel: 3,
flatten: true ,
cache: false
},
build: {
expand: true,
cwd: 'public/images',
src: ['**/*.{png,jpg,gif}'],
dest: 'images/min'
}
}
});
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.registerTask('default', ['imagemin']);
};
and i got this error
Fatal error: This socket is closed.
and this is a full error details
Command-line options: --verbose
Reading "Gruntfile.js" Gruntfile...OK
Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK
Registering "grunt-contrib-imagemin" local Npm module tasks.
Reading C:\Users\Mohamed\Desktop\egwebstorm\node_modules\grunt-contrib-imagemin\package.json...OK
Parsing C:\Users\Mohamed\Desktop\egwebstorm\node_modules\grunt-contrib-imagemin\package.json...OK
Loading "imagemin.js" tasks...OK
+ imagemin
Loading "Gruntfile.js" tasks...OK
+ default
No tasks specified, running default tasks.
Running tasks: default
Running "default" task
Running "imagemin" task
Running "imagemin:build" (imagemin) task
Verifying property imagemin.build exists in config...OK
Files: public/images/facebook.png -> images/min/facebook.png
---- the list of other images -----
Options: interlaced, optimizationLevel=3, progressive, flatten, cache=false
Fatal error: This socket is closed.
and no image folder created or anything changed ,and i reviewed the code but i didn't know if there's something need to fixed
Try to re-install imagemin:
npm uninstall grunt-contrib-imagemin
npm install --save-dev grunt-contrib-imagemin
Related
Currently working on a react app and I'm getting this error after installing metaplex.
My react-scripts version is 4.0.3
./node_modules/#metaplex-foundation/js-next/dist/esm/programs/token/gpaBuilders/TokenGpaBuilder.mjs
Can't import the named export 'ACCOUNT_SIZE' from non EcmaScript module (only default export is available)
I found out the solution in the git of metaplex here. I will leave you here the whole answer anyway.
Getting Started with Metaplex and CRA 5
This example sets up a new React app with Metaplex using "Create React App" (CRA) version 5 — i.e. using Webpack 5.
This example has been generated using the following steps:
Create a new project using the "Create React App" command.
npx create-react-app getting-started-react-cra5
cd getting-started-react-cra5
Install the Metaplex and the Solana SDKs.
npm install #metaplex-foundation/js #solana/web3.js
Install some polyfills.
npm install assert util crypto-browserify stream-browserify
Install and use react-app-rewired.
# Installs react-app-rewired.
npm install react-app-rewired
# Replaces "react-scripts" with "react-app-rewired" in package.json scripts.
sed -i '' 's/react-scripts /react-app-rewired /g' package.json
Override Webpack 5 configurations.
Create a new file to override Webpack 5 configurations.
touch config-overrides.js
Copy the following code inside the new config-overrides.js file.
const webpack = require("webpack");
module.exports = function override(webpackConfig) {
// Disable resolving ESM paths as fully specified.
// See: https://github.com/webpack/webpack/issues/11467#issuecomment-691873586
webpackConfig.module.rules.push({
test: /\.m?js/,
resolve: {
fullySpecified: false,
},
});
// Ignore source map warnings from node_modules.
// See: https://github.com/facebook/create-react-app/pull/11752
webpackConfig.ignoreWarnings = [/Failed to parse source map/];
// Polyfill Buffer.
webpackConfig.plugins.push(
new webpack.ProvidePlugin({ Buffer: ["buffer", "Buffer"] })
);
// Polyfill other modules.
webpackConfig.resolve.fallback = {
crypto: require.resolve("crypto-browserify"),
stream: require.resolve("stream-browserify"),
util: require.resolve("util"),
assert: require.resolve("assert"),
fs: false,
process: false,
path: false,
zlib: false,
};
return webpackConfig;
};
Update your browser requirements.
Update the browserslist object of your package.json to include the following production requirements.
"browserslist": {
"production": [
- ">0.2%",
- "not dead",
- "not op_mini all"
+ "chrome >= 67",
+ "edge >= 79",
+ "firefox >= 68",
+ "opera >= 54",
+ "safari >= 14"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
That's it!
You should not use #metaplex-foundation/js-next SDK, the actual repo is #metaplex-foundation/js, the name was changed and the updated repo is this, so try using #metaplex-foundation/js instead
I have created a new consortium on Azure Blockchain Service and set up Visual Studio Code using Azure Blockchain Development Kit extension. I have my consortium set up in VSCode and also created a new solidity project. I compiled/built the default HelloBlockchain smart contract successfully. But when I deployed the contract, it gave me this error:
Get version for required apps: truffle
[Execute command]
Working dir: /home/manul/securevoting/blockchain
Running command
npx truffle migrate --reset --network electionmanagement
[Execute command]
Compiling your contracts...
[Execute command] ===========================
[Execute command] > Everything is up to date, there is nothing to
compile.
[Execute command]
[Execute command] Finished running command
[Azure Blockchain] HttpService.sendRPCRequest has done with error:
RequestError: Error: connect ECONNREFUSED 127.0.0.1:8545
[Azure Blockchain] HttpService.sendRPCRequest has done with error:
RequestError: Error: connect ECONNREFUSED 52.168.92.164:3200
Here is my truffle-config.js:
const HDWalletProvider = require('truffle-hdwallet-provider');
const fs = require('fs');
module.exports = {
networks: {
development: {
host: "127.0.0.1",
port: 8545,
network_id: "*"
},
electionmanagement: {
network_id: "*",
gas: 0,
gasPrice: 0,
provider: new HDWalletProvider(fs.readFileSync('/home/manul/securevoting/blockchain/administrator.env', 'utf-8'), "https://administrator.blockchain.azure.com:3200/5GJ3H0vdRuvo6AkPDFRRbxL0"),
consortium_id: 1565975083891
}
},
mocha: {},
compilers: {
solc: {
version: "0.5.0"
}
}
};
Here is 2_deploy_contracts.js file in migrations folder:
var HelloBlockchain = artifacts.require("HelloBlockchain");
var Arg = "Hello world";
module.exports = deployer => {
deployer.deploy(HelloBlockchain, Arg);
};
A screenshot of my VSCode Window
Any help would be greatly appreciated.
I was experiencing the same error. I guess the blockchain services are not permitted on your college's wifi/LAN. Just use VPN or Mobile Hotspot, not your college's wifi/LAN.
I was executing my scripts on firefox and got one notification for Firefox upgrade which I closed. Started execution again but I'm getting error as below,
Rohits-MacBook-Pro:FFAutomation rohitgathibandhe$ /Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/bin/protractor conf.js
Report destination: target/screenshots/Report.html
Using FirefoxDriver directly...
[launcher] Running 1 instances of WebDriver
/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/node_modules/selenium-webdriver/http/util.js:83
Error('Timed out waiting for the WebDriver server at ' + url));
^
Error: Timed out waiting for the WebDriver server at http://127.0.0.1:50636/hub
at Error (native)
at onError (/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/node_modules/selenium-webdriver/http/util.js:83:11)
at Promise.invokeCallback_ (/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1329:14)
at TaskQueue.execute_ (/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2790:14)
at TaskQueue.executeNext_ (/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2773:21)
at /Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2652:27
at /Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7
at process._tickCallback (node.js:406:9)
From: Task: WebDriver.createSession()
at acquireSession (/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:62:22)
at Function.createSession (/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:295:12)
at Driver (/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/node_modules/selenium-webdriver/firefox/index.js:271:38)
at [object Object].DirectDriverProvider.getNewDriver (/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/built/driverProviders/direct.js:76:16)
at [object Object].Runner.createBrowser (/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/built/runner.js:203:37)
at /Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/built/runner.js:293:21
at _fulfilled (/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/node_modules/q/q.js:796:13)
at /Users/rohitgathibandhe/npm-global/lib/node_modules/protractor/node_modules/q/q.js:556:49
[launcher] Process exited with error code 1
My config file is as below,
var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
var reporter = new HtmlScreenshotReporter({
dest: 'target/screenshots',
filename: 'Report.html',
reportTitle: 'Execution Report',
showSummary: true,
showQuickLinks: true,
pathBuilder: function(currentSpec, suites, browserCapabilities) {
// will return chrome/your-spec-name.png
return browserCapabilities.get('browserName') + '/' + currentSpec.fullName;
}
});
exports.config = {
directConnect: true,
//seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {'browserName': 'firefox'},
framework: 'jasmine',
specs: ['Login_spec2.js','Article_spec.js'],
allScriptsTimeout: 200000,
getPageTimeout: 200000,
jasmineNodeOpts: {
defaultTimeoutInterval: 200000
},
// Setup the report before any tests start
beforeLaunch: function() {
return new Promise(function(resolve){
reporter.beforeLaunch(resolve);
});
},
// Close the report after all tests finish
afterLaunch: function(exitCode) {
return new Promise(function(resolve){
reporter.afterLaunch(resolve.bind(this, exitCode));
});
},
onPrepare: function() {
var width = 1300;
var height = 1200;
browser.driver.manage().window().setSize(width,height);
jasmine.getEnv().addReporter(reporter);
afterAll(function(done) {
process.nextTick(done);
})
}
};
Other details are:
Other details are as below: protractor#3.2.2, nodeVersion: 4.2.4, npmVersion: 2.14.12, jasmine: 2.4.1, selenium-webdriver: 2.52.0, firefox: 47
Kindly help me with solution to this issue.
You have to do the following to make it work:
upgrade protractor to the latest, currently 3.3.0, version which would also bring selenium-webdriver 2.53
downgrade firefox to version 46 and don't let it update for a while (there are compatibility issues)
In my case it was the local firewall (iptables on Linux) that was very restrictive such that WebDriver could not contact the Selenium server hub at whatever TCP port.
To make it work I turned off the firewall. The long term solution was to adjust the firewall rules such that this type of connection is allowed.
If you want your scripts communicate directly with the Firefox|Chrome Driver (bypassing the Selenium server entirely) then try adding the directConnect: true in your protractor.conf.js
I solved it by change the browser (use Chrome instead of Firefox).
In C:__projectWorkspace__\src\test\javascript\protractor.conf.js
modify the entry
capabilities: {
'browserName': 'firefox',
to
capabilities: {
'browserName': 'chrome',
That wasn't enough. I had to change also the webBrowserDriver 'cause after the JHipster installation the 2.22 version was written in protractor.conf.js file but in the path:
node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.25.exe
the chromedriver was 2.25 version so i edited the entry
webbrowserDriver = prefix + 'node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.25.exe';
and it worked!
I solved this by restarting the computer.
I don't know why, but I think that "suspending" the computer can cause some bad configuration with Selenium Server.
Ah, I run commands on the command prompt as an administrator.
I fixed this issue by changing directConnect to true in base.config.js from repository folder.
or
webdriver-manager clean and then webdriver-manager start
I've got a grunt task to compile & compress my JS & SASS files which all works fine locally but when I try using it on deploybot.com I just get an error stating:
sass sass/main.scss public/css/main.css --style=compressed --no-cache
This is my grunt file:
module.exports = function(grunt){
grunt.initConfig({
concat:{
options:{
stripBanners: true,
sourceMap: true,
sourceMapName: 'src/js/jsMap'
},
dist:{
src: ['js/vendor/jquery.slicknav.js', 'js/vendor/swiper.js', 'js/app/*.js'],
dest: 'src/js/main.js'
},
},
copy:{
js:{
files:[
{ src: 'src/js/main.js', dest: 'public/js/main.js', },
{ src: 'src/js/jsMap', dest: 'public/js/jsMap', }
],
},
},
uglify:{
production:{
options:{
sourceMap: true,
sourceMapIncludeSources: true,
sourceMapIn: 'src/js/jsMap', // input sourcemap from a previous compilation
},
files: {
'public/js/main.js': ['src/js/main.js'],
},
},
},
sass:{
dev:{
options:{
style: 'expanded'
},
files:{
'public/css/main.css': 'sass/main.scss'
}
},
production:{
options:{
style: 'compressed',
noCache: true
},
files:{
'public/css/main.css': 'sass/main.scss'
}
}
},
watch: {
dev:{
files: ['js/**/*.js', 'sass/*.scss'],
tasks: ['build-dev'],
options: {
spawn: false,
interrupt: true,
},
},
},
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('build-dev', ['concat', 'copy:js', 'sass:dev']);
grunt.registerTask('build-prod', ['concat', 'uglify:production', 'sass:production']);
grunt.registerTask("watch-dev", ['watch:dev']);
};
These are the commands I'm running to compile & compress my code, all the version specific stuff was to try and fix the problem I have the same issue when remove it.
nvm install 0.10.25
nvm use 0.10.25
npm uninstall grunt -g
npm install grunt-cli -g
npm install grunt#0.4.5 --save-dev
npm install -g grunt-cli
npm install --save-dev
grunt build-prod --stack --verbose --debug
This is what is shown in the log file after the node & grunt install bits:
output Loading "Gruntfile.js" tasks...OK
output + build-dev, build-prod, watch-dev
output Running tasks: build-prod
output Running "build-prod" task
output [D] Task source: /source/Gruntfile.js
output Running "concat" task
output [D] Task source: /source/node_modules/grunt-contrib-concat/tasks/concat.js
output Running "concat:dist" (concat) task
output [D] Task source: /source/node_modules/grunt-contrib-concat/tasks/concat.js
output Verifying property concat.dist exists in config...OK
output Files: js/vendor/jquery.slicknav.js, js/vendor/swiper.js, js/app/centre-events-boxes.js, js/app/centre-footer.js, js/app/club.move-nav.js, js/app/club.social-link-position.js, js/app/func.stick-to-top.js, js/app/home.move-nav.js, js/app/home.stick-to-top.js, js/app/match-event-box-height.js, js/app/slicknav.js, js/app/swiperjs-slider.js -> src/js/main.js
output Options: separator="\n", banner="", footer="", stripBanners, process=false, sourceMap, sourceMapName="src/js/jsMap", sourceMapStyle="embed"
output Reading js/vendor/jquery.slicknav.js...OK
output Reading js/vendor/swiper.js...OK
output Reading js/app/centre-events-boxes.js...OK
output Reading js/app/centre-footer.js...OK
output Reading js/app/club.move-nav.js...OK
output Reading js/app/club.social-link-position.js...OK
output Reading js/app/func.stick-to-top.js...OK
output Reading js/app/home.move-nav.js...OK
output Reading js/app/home.stick-to-top.js...OK
output Reading js/app/match-event-box-height.js...OK
output Reading js/app/slicknav.js...OK
output Reading js/app/swiperjs-slider.js...OK
output Writing src/js/jsMap...OK
output Source map src/js/jsMap created.
output Writing src/js/main.js...OK
output File src/js/main.js created.
output Running "uglify:production" (uglify) task
output [D] Task source: /source/node_modules/grunt-contrib-uglify/tasks/uglify.js
output Verifying property uglify.production exists in config...OK
output Files: src/js/main.js -> public/js/main.js
output Options: banner="", footer="", compress={"warnings":false}, mangle={}, beautify=false, report="min", expression=false, maxLineLen=32000, ASCIIOnly=false, screwIE8=false, quoteStyle=0, sourceMap, sourceMapIncludeSources, sourceMapIn="src/js/jsMap"
output Minifying with UglifyJS...Reading src/js/jsMap...OK
output Parsing src/js/jsMap...OK
output Reading src/js/main.js...OK
output OK
output Writing public/js/main.js...OK
output Writing public/js/main.js.map...OK
output File public/js/main.js.map created (source map).
output File public/js/main.js created: 192.88 kB → 77.01 kB
output >> 1 sourcemap created.
output >> 1 file created.
output Running "sass:production" (sass) task
output [D] Task source: /source/node_modules/grunt-contrib-sass/tasks/sass.js
output Verifying property sass.production exists in config...OK
output Files: sass/main.scss -> public/css/main.css
output Options: style="compressed", noCache
output Command: sass sass/main.scss public/css/main.css --style=compressed --no-cache
output Errno::EISDIR: Is a directory # rb_sysopen - public/css/main.css
output Use --trace for backtrace.
output Warning: Exited with error code 1 Use --force to continue.
output Aborted due to warnings.
I've been trying to fix this for days and have no ideas. I've tried contacting their support too.
Turns out after contacting their support team multiple times the problem was on their end, something to do with a caching mechanism I think. Nothing I could do to solve it without their support though.
I am a noob to grunt and would like to start using it.
Here is my gruntfile:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
devDir: 'dev/dir',
prodDir: 'prod/dir',
'sftp-deploy': {
prod: {
auth: {
host: 'server.com',
port: 22,
authKey: {
"username": "username1",
"password": "password2"
}
},
src: '<%=devDir%>',
dest: '/test/env/',
concurrency: 4,
progress: true
}
}
});
// load modules
grunt.loadNpmTasks('grunt-sftp-deploy');
// Default task(s).
grunt.registerTask('default', ['sftp-deploy']);
};
I am getting this error when i run 'grunt' in powershell:
Running "sftp-deploy:prod" (sftp-deploy) task
Logging in with username username1
Concurrency : 4
Fatal error: Connection :: error
What am I doing wrong?
thanks!
Ok, a few things to try... (sorry - a month late!)
run:
grunt sftp-deploy --verbose
This will give you a little more info regarding your error.
I solved my error after realising I couldn't create folders on my server, only upload files. So it might be worth testing that you can accomplish manually what your asking grunt to do.
Lastly, try moving your username / password into a .ftppass file
link [here] (https://www.npmjs.com/package/grunt-sftp-deploy)