I've installed Cloud9 IDE on my linux machine in order to play around with it a bit (I had to use nodejs 0.8 because cloud9 uses a package that depends on node-waf, which is no longer supported by higher versions of nodejs).
I can start it up without problems, however when I try to access Cloud9 via browser, it constantly gives me the error message: File already exists.. Here's a trace from the log:
Error: File already exists.
at module.exports.from (/home/xyz/repos/cloud9/node_modules/vfs-local/localfs.js:678:35)
at Object.fs.exists [as oncomplete] (fs.js:91:19)
Relevant code section:
exists(topath, function(exists){
if (options.overwrite || !exists) {
// Rename the file
fs.rename(frompath, topath, function (err) {
if (err) return callback(err);
// Rename metadata
if (options.metadata !== false) {
rename(WSMETAPATH + from, {
to: WSMETAPATH + to,
metadata: false
}, function(err){
callback(null, meta);
});
}
});
}
else {
var err = new Error("File already exists.");
err.code = "EEXIST";
callback(err);
}
When the error occurs, the topath variable is set to the workspace settings file (/home/xyz/repos/cloud9/workspace/.settings)
Has anyone else had an error like this? How can I resolve it?
thx in advance
Reinstalling cloud9
First option, maybe you could try using this workaround installation procedure:
https://github.com/ajaxorg/cloud9/issues/2904#issuecomment-22518669
Second option, if you are willing to always use an older node-version for running cloud9 as you indicated, I used the following installation procedure and it worked (assuming you already installed nvm). Then you can still use the cloud9.sh-file for starting:
git clone git://github.com/ajaxorg/cloud9.git
cd cloud9
nvm install 0.8.8
sed -i -e 's/~//g' package.json
npm config set ca=""
npm install
sed -i s/connect.session.file/connect.session.memory/ configs/default.js
Not sure if 0.8.8 is the best node-version for cloud9 but it works for me :)
Last step seems necessary because of https://github.com/ajaxorg/cloud9/issues/2005#issuecomment-11372587 :)
Then before starting cloud9 you always have to enter:
nvm use 0.8.8
Or you set 0.8.8 as the default node version if you don't use node much otherwise:
nvm alias default 0.8.8
Fix problem without reinstalling
Third option, if you don't want to repeat the installation procedure you could try just reinstalling the vfs-local-module in the cloud9 directory:
npm install vfs-local#0.3.4
Haven't tested this though :)
Related
I have this problem when I upload a file on the server using the extension liximomo/vscode-sftp for visual studio code.
[error] Error: No such file
at SFTPStream._transform
at SFTPStream.Transform._read
at SFTPStream._read
How I can fix this problem? I tried to upload files to different servers, so I guess it's not a server-related problem but an extension.
There is a better fix on GitHub that works for upload and download via SFTP extension:
Do a search inside ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js for options.emitClose = false;
Add options.autoDestroy = false; after both instances.
- mrjcgoodwin commented 8 days ago
This is apparently a brand new problem that has been introduced into the newer versions of VS Code. I have FOUND A SOLUTION that seems to work well, by modifying a single line in the extension code. This is only valid for version 1.12.9 of the liximomo.sftp extension.
Here are the steps:
Shutdown / Quit VS Code.
Locate the following file:Mac OS X:
~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.jsWindows:C:\Users\account_name\.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\sftp.js
Make a backup copy of the file.
Modify line 388, which should be:if ( code === STATUS_CODE . OK ) { changing it to:if (code === STATUS_CODE.OK || code === STATUS_CODE.NO_SUCH_FILE) {
Save the file.
Relaunch VS Code; test by uploading or downloading from your sftp server. The error should not be present.
The alternative solution involves downgrading your version of VS Code. This is not desirable as you are not getting the latest fixes, security patches, etc..
See the following links regarding this issue:
https://github.com/liximomo/vscode-sftp/issues/266
https://github.com/liximomo/vscode-sftp/issues/569 (repeat)
https://gitmemory.com/issue/liximomo/vscode-sftp/915/827578565 (note, this site has a bad SSL certificate).
If you want to downgrade your VS Code; use this link to find the older versions:
https://code.visualstudio.com/updates/v1_55
CREDIT:
Bao from: https://blog.naver.com/PostView.nhn?blogId=pcgun70&logNo=222341271496
From their blog entry (translated by Google to English):
"At first, there was no solution, but Now, 12 hours later, the Holy
One appeared, who told me how to solve it.files that sftp cannot find
in the first place. There is a calling phrase, VScode is upgraded and
an error is called. It came out. Actually, I did not solve the
problem. Even if the file is not found, the same result as the
success process is exported. It is just a modification. It is
expected that a modified version will be released in the future."
Not an answer to the problem, but solution in another (simple) way:
install Run On Save VSCode extension
write a deploy.sh script along the lines
rsync -avz -e 'ssh -i /home/user/.ssh/id_rsa' --exclude '.history' --exclude '.vscode' --exclude '.git' --exclude '.gitignore' --exclude 'deploy.sh' ./ user#domain.net:/home/user/public_html/
add the following configuration to VSCode settings.json to trigger the deploy.sh script on file save:
"emeraldwalk.runonsave": {
"commands": [
{
"match": ".*",
"isAsync": false,
"cmd": "${workspaceFolder}/deploy.sh"
},
]
}
Just switch to the second one:
There is another solution only upgrading the ssh2 package from the extension.
You just need to go to the extension path:
Windows:
C:\Users\your-user\.vscode\extensions\liximomo.sftp-1.12.9
When you are there, change the version of ssh2 package on the package.json file to ^1.1.0. Finally, just run npm install.
You should restart VSCode.
Alternatively, you could use a fork of the repository that is active and fixing these issues: https://github.com/Natizyskunk/vscode-sftp
I am using yarn 2 and react with webpack.
In my package is "typescript": ... defined. Once I start yarn start I am getting an error:
yarn workspace test start
When you use this plugin you must install `typescript`.
What is wrong? How should I fix it? Or debug it?
I've faced the similar issue when I was upgrading webpack from 4 to 5.
The problem was the version of react-dev-utils
Upgrading react-dev-utils from v10 to v12 made the issue disappear.
devDependencies {
...
"react-dev-utils": "^12.0.1",
...
}
You can be checked the value of your plugins config about ForkTsCheckerWebpackPlugin which the param key named tsconfig.
Error Message
Check [key, value] about ForkTsCheckerWebpackPlugin.
Find it in your node_modules, and set debug point, run the debugger.
You need to take a look at your webpack.config.js where ForkTsCheckerWebpackPlugin is initialized. ForkTsCheckerWebpackPlugin needs to be able to find the tsconfig file.
new ForkTsCheckerWebpackPlugin({
typescript: resolve.sync('typescript', {
basedir: paths.appNodeModules,
tsconfig: paths.appTsConfig,
})
}),
In my case I'm defining paths.appNodeModules and paths.appsTsConfig in a file called paths.js.
module.exports = {
appTsConfig: resolveApp('tsconfig.json'),
appNodeModules: resolveApp('node_modules'),
};
I run locally on my project the following command
gometalinter --config=gometalinter.json ./...
at the beginning I got some errors and I was fixed them all!
now I run the same command exaclty in Travis script
and I got vendor errros like
vendor/github.com/spf13/viper/flags.go:3:8:warning: error return value not checked (could not import github.com/spf13/pflag (go/build: importGo github.com/spf13/pflag: exit status 1) (errcheck)
vendor/github.com/spf13/viper/viper.go:42:7:warning: error return value not checked (could not import github.com/pelletier/go-toml (go/build: importGo github.com/pelletier/go-toml: exit status 1) (errcheck)
This is the gometalinter.json for the config
{
"vendor": true,
"Deadline": "2m",
"Sort": [
"linter",
"severity"
],
"DisableAll": true,
"Enable": [
"gotypex",
"vetshadow",
"errcheck",
"gocyclo",
"vet",
"golint",
"vetshadow",
"ineffassign",
],
"Cyclo": 10,
"LineLength": 120
}
I dont understand why locally I dont get this error (i've the vendor repo) and why it ask for vendor error ? what could be the reason ?
gometalinter runs binaries in your path to do its check. I have had problems where my CI would have one set of binaries versions while my local development environment would have different versions.
Try updating all the required binaries on your local machine.
Try --vendor flag and check versions of gometalinter and all used linters.
Extract from gometalinter documentation:
How do I make gometalinter work with Go 1.5 vendoring?
gometalinter has a --vendor flag that just sets
GO15VENDOREXPERIMENT=1, however the underlying tools must support it.
Ensure that all of the linters are up to date and built with Go 1.5
(gometalinter --install --force) then run gometalinter --vendor ..
That should be it.
I am trying to install a github project using composer and get the following error
Composer [UnexpectedValueException]
Your Github oauth token for github.com contains invalid characters: ""
Can anyone explain what I need to do to correct this error?
I am using the following command
composer create-project --prefer-dist --stability=dev vova07/yii2-start yii2-start
Thank you
I started getting a similar error and the reason was that Github recently changed the format of their auth tokens:
https://github.blog/changelog/2021-03-31-authentication-token-format-updates-are-generally-available/
To resolve the error:
Find the composer/auth.json file (if you're running the project in a container, you'll have to bash into it and find the file in there)
Remove its github.com entry. Your file will probably look like the following after removing the entry: {"github-oauth": {}}
Run composer self-update. The issue got resolved in version 2.0.12. See the first item in the changelog for that version here: https://getcomposer.org/changelog/2.0.12
After that, you can restore your composer/auth.json file to its initial state as the newer version of composer will recognize the new key format.
You can try Basic Auth instead:
Change this (oauth):
"github-oauth": {
"github.com": "ghp_[YOUR-PERSONAL-TOKEN]"
}
To this (basic auth):
"http-basic": {
"github.com": {
"username": "[YOUR-GITHUB-USERNAME]",
"password": "ghp_[YOUR-PERSONAL-TOKEN]"
}
}
You can find instructions on how to create a Personal Access Token
Inspired from github docs. Apparently, you can use Basic Authentication with a Personal Access token instead of oauth in some cases (e.g. like mine: installing a private git repo with composer).
I fixed it.
Goto C:\Users\XXXXX\AppData\Roaming\Composer
Open the auth.json
delete the github.com entry under "github-oauth": {}
That's it.
Update answer for Masiorama and Ruchir Mehta:
If you looking for file auth.json but don't know how, use this command:
locate auth.json
And here's the result:
You can see that auth.json will look like this:
/home/{your user name}/.config/composer/auth.json
Then you could use this command to edit the file:
sudo gedit /home/dev/.config/composer/auth.json
And remove content inside github-oauth.
If you're on MacOS, the auth.json file is at ~/.composer/auth.json. Then from there, you can remove the value for github-oauth. I tried fully deleting the file but I got a parse error, Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['. Your auth.json file should look like this:
{
"github-oauth": {}
}
This is similar to other answers posted but I wasn't able to use the locate command on MacOS so this might be helpful to other Mac users
This error recently popped up from nowhere.
Simply deleting the whole auth file worked for me..! Not sure why / when it appeared in the first place.
~/.composer/auth.json
As far as I know (I'm a beginner with composer too), the problem is with your authentication, so you have to fix your credentials in auth.json inside path-to-composer/.composer/
Inside you will find a json which will probably looks like:
{
"github-oauth": {
"github.com": null
}
}
Fix that and you should be ok ;)
The solution is just to upgrade your Composer version
using command composer self-update.
Go to C:\Users\UserName\AppData\Roaming\Composer
Open the auth.json file.
Clear everything and paste the below code
{
"bitbucket-oauth": {},
"github-oauth": {},
"gitlab-oauth": {},
"gitlab-token": {},
"http-basic": {},
"bearer": {}
}
I hope it will be solved
I run in the same problem after upgrading githup api token to the new format.
The answer is you need to upgrade composer version 1.10.21 or higher that fixes this problem.
Same solution as the answer of Paulina Khew but with command lines on MacOS :
cd ~/.composer/
nano auth.json
Delete what is inside th bracket :
{
"github-oauth": {}
}
When you're ready to save the file, hold down the Ctrl key and press the letter O
Press the Enter key on your keyboard to save.
When finished, press Ctrl + X to close nano and return to your shell.
Edit the composer authentication configuration file ~/.composer/auth.json
Then replace the following.
"http-basic": {
"github.com": {
"username": "[YOUR-GITHUB-USERNAME]",
"password": "ghp_[YOUR-PERSONAL-TOKEN]"
}
}
Now run the command composer install
That's a bug.
If you have Debian or Ubuntu, try this patch. Otherwise read the last line.
Quick copy-paste patch
If you have Debian 10 buster or Ubuntu 20.LTS or similar distributions, try this copy-paste command:
wget https://gist.githubusercontent.com/valerio-bozzolan/84364c28a3bba13751c504214016adcf/raw/c1356d529c89c10de4c959058e2e86ffe58fa407/fix-composer.patch -O /tmp/fix-composer.patch
sudo patch /usr/share/php/Composer/IO/BaseIO.php /tmp/fix-composer.patch
If it does not work, write it in the comments.
Step-by-step explaination
Your Composer version has a bug: you are able to save a valid GitHub token, but then it's not able to read that token again because Composer thinks that your GitHub token cannot contain underscores or stuff like that. Moreover, it's strange that Composer checks its syntax only the second time. Why? that's another story.
The fix is simple. You can temporary disable that wrong validation in your Composer version. Also because GitHub is a proprietary service and their specifications can change over time (as you demonstrated today). So it makes sense not to validate the syntax of GitHub tokens. The only person who should hard-validate GitHub tokens is GitHub itself, not Composer.
If you installed Composer via apt install composer, probably you will not have any update available and surely you cannot use self-update because Composer is read-only for security reasons (and for a similar reason, you should not execute Composer from root). Instead, you can create a safe hot-patch to fix that specific issue.
To create a patch, create a file called /tmp/fix-composer.patch with this exact content:
103,105c103,105
< if (!preg_match('{^[.a-z0-9]+$}', $token)) {
< throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
< }
---
> // if (!preg_match('{^[.a-z0-9]+$}', $token)) {
> // throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
> //
That content can also be seen from here:
https://gist.github.com/valerio-bozzolan/84364c28a3bba13751c504214016adcf
Then run this command to apply that patch:
sudo patch /usr/share/php/Composer/IO/BaseIO.php /tmp/fix-composer.patch
If it does not work, probably you have not installed composer via apt.
In short, whatever operating system, and whatever installation method, locate the file BaseIO.php in your Composer and comment out the validation check.
I'm using expressjs and connect-mongo#0.1.7 as the MongoStore for session.
What happen is, the session code was working. but after I upgrade node and npm to the latest version, and Mongo to 2.0.2, then if I put express.session ( store:new MongoStore) then it will run a infinite loop. Any idea what's happening?
here is my code:
express.createServer(
express.cookieParser(),
express.bodyParser(),
express.session({ secret: cfg.session_secret,
cookie: { domain: 'mydomain.com' },
store:new MongoStore({
db: cfg.db_session_name,
host: cfg.db_ip,
port: cfg.db_port
})
})
)
Here is the error:
TypeError: Not a string or buffer
at Object.createHmac (crypto.js:129:21)
at Object.sign (/node_modules/connect-mongo/node_modules/connect/lib/utils.js:135:6)
at Object.serialize (/node_modules/connect-mongo/node_modules/connect/lib/middleware/session/cookie.js:115:17)
at ServerResponse.writeHead (/node_modules/express/node_modules/connect/lib/middleware/session.js:265:46)
at ServerResponse._implicitHeader (http.js:808:8)
at ServerResponse.end (http.js:645:10)
at next (/node_modules/express/node_modules/connect/lib/http.js:167:13)
at pass (/node_modules/express/lib/router/index.js:219:24)
at nextRoute (/node_modules/express/lib/router/index.js:209:7)
at callbacks (/node_modules/express/lib/router/index.js:274:11)
Just got the temp solution for that. from another noder "jacobstr"
see this: https://github.com/kcbanner/connect-mongo/issues/29#issuecomment-4233108
So, I go to node_modules/connect-mongo folder. Edit the package.json like that: https://github.com/jacobstr/connect-mongo/blob/master/package.json (only one change: <2 ).
Then in that folder, run sudo npm install -d
then everything works. :)
I ran into the same issue. I believe this is being caused by express and connect-mongo using different versions of connect and those different versions have different method signatures for the cookieParser. The version connect-mongo is using expects to be passed a "secret" key for signing the session data, but the version express uses does not supply it.
There is an update to express on GitHub to support connect 2.0, but it is not available via npm yet.