Error installing Sublime Text 3 Package Control bz2 - sublimetext3

My ISP in India has decieded to block Github for some reason.I have been trying to install Package Control for Sublime Text 3 both manually and use the Sublime Text 3 Console.In both of the cases,one dependency seems to be missing:
Package Control: Installing 1 missing dependencies
Package Control: Attempting to use Urllib downloader due to WinINet error: Error downloading package. Host not found (errno 12007) during HTTP write phase of downloading https://codeload.github.com/codexns/sublime-bz2/zip/1.0.0.
Package Control: Error downloading package. URL error [Errno 11004] getaddrinfo failed downloading https://codeload.github.com/codexns/sublime-bz2/zip/1.0.0.
error: Package Control
Unable to download bz2. Please view the console for more details.
Package Control: Skipping automatic upgrade, last run at 2015-01-03 11:32:25, next run at 2015-01-03 12:32:25 or after
I have downloaded the Sublime bz2 file manually,what should I do now?
EDIT:
Some skimming through stuff tells me that Package Control 3.0 has dependencies:
Once the package is extracted, a custom-generated python file is added to a special package named
0_package_control_loader. For Sublime Text 3, this is a .sublime-package file, whereas for
Sublime Text 2 it is just a folder. The reason for the name (and creating it as a .sublime-
package file in ST3) is to ensure it is the very first non-default package that Sublime Text
loads.
Is there a version of 0_package_control_loader.sublime-package that I can add manually(given that I have already installed Package Control with this dependency missing?

I've met the same problem as you. Below is the way I resolved it.
Try to get the file "sublime-bz2-1.0.0.zip". (It seems you have done it);
unzip it to the dictory "...\Application Data\Sublime Text 3\Packages\" and rename the sub-dictory name to "bz2".
open a new txt file and paste below code to it
{"platforms": ["*"], "url": "https://github.com/codexns/sublime-bz2/issues";, "version": "1.0.0", "description": "Python bz2 module", "sublime_text": "*"}
save the file to /bz2 and rename its file name as "dependency-metadata.json"
After done these, the hierarchy should be like this:
/Package
├─/bz2
│ ├─/st2_linux_x32
│ ├─/st2_linux_x64
│ ├─/st2_windows_x32
│ ├─/st2_windows_x64
│ ├─/st3_linux_x32
│ ├─/st3_linux_x64
│ ├─/st3_osx_x64
│ ├─/st3_windows_x32
│ ├─/st3_windows_x64
│ └─dependency-metadata.json
└─/User
├─/c2u_tmp
└─/Package Control.cache
restart sublime text3.
Hope it helps!
Regards

This worked for me, see: #godzig's answer, on this related Github issue: issues/989. The gist of it being:
open the 0_package_control_loader.sublime-package archive, in Installed Packages, of your SBT3 folder. Change the filename from 02-bz2.py to 01-bz2.py, and the error is gone; at least in my case anyway.
HTH

I got the same problem and I try and fix it by use manual installation like this:
Manual
If for some reason the console installation instructions do not work for you (such as having a proxy on your network), perform the following steps to manually install Package Control:
Click the Preferences > Browse Packages… menu
Browse up a folder and then into the Installed Packages/ folder
Download Package Control.sublime-package and copy it into the Installed Packages/ directory
Restart Sublime Text

Until your ISP unblocks Github (who does that?), you can download 0_package_control_loader.sublime-package here. I don't know if there are differences in the package for different versions of Windows, but this is from ST3 on Win8. Hope it helps!

Machael Lv's answer didn't help for me.
Then i just started sublime text as administrator for one time and problem dissapeared - now i can run sbt as ussual and error message doesn't appear again.

import urllib.request,os,hashlib;
h = '2deb499853c4371624f5a07e27c334aa' + 'bf8c4e67d14fb0525ba4f89698a6d7e1';
pf = 'Package Control.sublime-package';
ipp = sublime.installed_packages_path();
urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) );
by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read();
dh = hashlib.sha256(by).hexdigest();
print('Error validating download (got %s instead of %s), please try manual install' % (dh, h))
if dh != h
else open(os.path.join( ipp, pf), 'wb' ).write(by)

Related

How to install Gin with Golang

I'm a newbie on Golang, and I'm trying to use Gin to develop a web server on Ubuntu 16.04.
After executing go get -u github.com/gin-gonic/gin, many folders appear at ~/go/pkg/mod/github.com/.
Then I try to make an example:
package main
import "github.com/gin-gonic/gin"
func main() {
r := gin.Default()
r.GET("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "pong",
})
})
r.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
}
However, go run example.go made the error:
example.go:3:8: cannot find package "github.com/gin-gonic/gin" in any of:
/usr/local/go/src/github.com/gin-gonic/gin (from $GOROOT)
/home/zyh/go/src/github.com/gin-gonic/gin (from $GOPATH)
In my system, $GOROOT is /usr/local/go/ and $GOPATH is ~/go/.
How could I solve this problem?
For Go version 1.11 or newer, You should use Go Modules.
If you are just starting with Go, you should start with the newer version. I think you are using a Go version that supports go modules already because the modules you are trying to get are downloading to ~/go/pkg/mod/ directory.
To initialize a project with go module, run:
go mod init your-project-name
This will create a go.mod file in your project directory.
Add missing and/or remove unused modules:
go mod tidy
This will fill up the go.mod file with appropriate modules and create a go.sum in your project directory. The go.sum contains expected cryptographic hashes of each module version.
After that, the go run example.go command should run the program without any issues.
You can even vendor the modules in your project directory:
go mod vendor
This will bring all the vendors to your projects /vendor directory so that you don't need to get the modules again if working from another machine on this project.
I realized that after adding a package called gopls, my IDE is working perfectly.
Install gopls using snap: sudo snap install gopls --classic
From the error, you can see that GOPATH is your '/home/zyh/go' not your ~/go.
and you can run shell go env to confirm where is your GOPATH? then modify it.

Installing a package with cabal doesn't work (random)

I'm using Windows 10. I downloaded Cabal.exe, put it in my ghc-8.8.1\bin\ directory and ran it with command cabal update. It did nothing for a while, then it ended without any messages.
Now when I run cabal install random (trying to install package "random"), I get the following error:
cabal: Error: Could not find module: System.Random with any suffix:
["gc","chs","hsc","x","y","ly","cpphs","hs","lhs","hsig","lhsig"]. If the
module is autogenerated it should be added to 'autogen-modules'.
I have no clue why it does this.
I also tried installing the package manually (following the steps from here) - downloaded package random-1.1.tar.gz and ran:
cd filepathtopackage
c:\Program Files\Apps\ghc-8.8.1\bin\runhaskell.exe Setup configure
This for a change gives me the following error:
| C:\Program Files\Apps\ghc-8.8.1\lib\Cabal-3.0.0.0\HSCabal-3.0.0.0.o: unknown symbol '.file'
Setup: Setup: unable to load package 'Cabal-3.0.0.0'
When I run ghc-pkg list, Cabal is in there, so again, no clue why it does this.
Does anyone have any tips on how to resolve this?

Python setuptools package_data - pip fails on subfolders

I am trying to make my own pip package installation to work and I have troubles with subfolders in additional data specified in package_data. Everything seems to be fine (all data are included in produced .zip file), but when I run "pip install myapp", it says: "error: can't copy 'myapp\web\styles': doesn't exist or not a regular file"
Dirtree:
projectDir
setup.py
myapp
__init__.py
webapp.py
web
index.html
styles
style.css
setup.py:
from setuptools import setup
setup (
zip_safe = False,
name = "myapp",
version = "0.1",
packages = ["myapp"],
include_package_data = True,
package_data = {
"myapp": ["web/*", "web/styles/*"]
}
)
Command to create package:
python setup.py sdist
Command to install:
pip install myapp-0.1.zip
I have even try to specify MANIFEST.in (with no success):
include myapp/web/*.*
include myapp/web/styles/*.*
When I specify only MANIFEST.in withou package_data, installation success, but there are no files in site-packages/myapp/web so no package_data were copied.
I am quite desperate because I haven't found any suggestion what I am doing wrong and I have spent long time to make it work.
Thaks for any advice.
Ok, so I have a solution: I have used only MANIFEST.in and removed package_data from setup.py and everything works fine. I thought I have tried this before, but I was wrong.

Orchard CMS Packaging Theme/Module Fail - Cannot create a package that has no dependencies nor content

Orchard 1.8. While I can package the default theme successfully (TheThemeMachine) Using the command line instructions from here E.g
orchard> package create TheThemeMachine C:\Temp
packaging my own themes I get the following error
"Cannot create a package that has no dependencies nor content."
(the theme indeed has content)
Anybody have the same issue ? Rookie error I'm guessing..But help much appreciated as error appears undocumented.
This error happens when you have set wrong version for the module/theme. For NuGet it's important to have correct versioning. Make sure you have version in your Theme.txt following formats {x.x}, {x.x.x}, {x.x.x.x} (where x are only digits, each up to 10)
Valid:
1.0
0.0.0.1
01.4423.455.112312
1234567890.1234567890.1234567890.1234567890
Invalid:
1
.1
1.1.1.1.1
1.12345678901

Error code: 800A1391 Source: Microsoft JScript runtime error Running Grunt - Module is undefined

New Grunt user here who is using a lot of new tools (npm nodejs) today.
I've got Grunt "installed" and have been able to create a grunt.js file using the init task as described here: http://net.tutsplus.com/tutorials/javascript-ajax/meeting-grunt-the-build-tool-for-javascript/ and here: https://github.com/cowboy/grunt/blob/master/docs/getting_started.md. But whenever I run the "grunt" command I get an error:
Windows Script Host
Script: c:\users\[]\Documents\code\grunt\grunt.js
Line: 2
Char: 1
Error: 'module' is undefined
Code: 800A1391
Source: Microsoft JScript runtime error
As explained in the FAQ, you need to type grunt.cmd instead on Windows because the OS tries to launch grunt.js
Or you can install grunt-cli globally instead. This package will run any version of Grunt if it's been installed locally to your project.
SOLVED !!
So, this problem occur because windows by default associative < *.js > files
with >>
"Microsoft Windows Based Script Host".
grunt need to open by default with (grunt.cmd).
it easy to slove, by change default app (open with..)
Guide :
Go to any javascript file with "js" extension. (any file)
Right-Click(mouse) > Properties > "Opens with:" Change...(button)
Choose Notepad ( or any javascript IDE ).
PROBLEM SOLVED ! :)
good luck
If you're getting a "Microsoft JScript runtime error" that means that node.js isn't even getting invoked; instead Windows Script Host is trying to run your code. That's probably a problem with filetype associations; IIRC Windows defaults to trying to execute a ".js" file with WSH. You may wind up having to create a shortcut to your script, specifying a command line (probably something like "node %1") and a starting directory in order to make sure that it's executed properly.
It would help if you could tell us exactly how you're trying to invoke your code.
it seems that in the latest versions of the grunt modules, you would have to do the following to have it work under windows:
remove any globally installed grunt
npm uninstall -g grunt
install grunt-cli globally
npm install -g grunt-cli
install grunt locally into your project
npm install grunt
installing grunt (v0.4.x) globally does not seem to create the necessary grunt.cmd anymore. it seems that the recommendation is now to have grunt installed locally to be able to use version-specific Gruntfiles
As Florian F suggested, running grunt.cmd works. This is because of the process Windows is looking for your grunt command.
When typing grunt -h Windows will proceed to look for the following files:
./grunt.cmd
./grunt.* (grunt.js is found in this case which is why you see "module is undefined")
%APPDATA%/npm/grunt.cmd
An alternative to using "grunt.cmd" is to use grunter which simply renames the command to grunter... then you no longer have this problem.
To answer this, first we need to understand that the error is caused because it is being executed by Windows Script Host.
Now, run the code from your cmd promt with the following syntax:
>node <application_name>.js
this will allow the Node.js application to open through V8 JavaScript engine(Google's).
P.S: Please reply back if this has helped in resolving your issue else post the problem you are facing after trying this.
I had a similar issue, the problem is file association, I would recommend:
right click on a .js file and choose open with.
then you choose nodejs/node.exe (somewhere in "program files" folder
then make tick box where it says "always open .js files " (paraphrasing)
That should do the trick.
I went through the same issue when running an old Node project.
The issue was with the name of the js file, it was node.js. So the while running the command node node.js, it was opening up a windows dialogue box.
I just changed the name of the file to app.js and the error flew away.
So, in my case i had tryed all the mentioned above with no result.
But i have fund that im dont type: node in the full sentence as the following snipet
node script.js.And remember never understimate your own miscoding.
Solution:
Go to any javascript file with "js" extension. (any file)
Right-Click(mouse) > Properties > "Opens with:" Change...(button)
Choose Notepad ( or any Javascript IDE like VS Code ).

Resources