'.' is not recognized as an internal or external command - wdio - node.js

When I try to run the code ./node_modules/.bin/wdio config
I have got this error:
'.' is not recognized as an internal or external command, operable
program or batch file.
Package.json
"#wdio/cli": "^6.1.22",
"#wdio/local-runner": "^6.1.22",
"#wdio/mocha-framework": "^6.1.19",
"#wdio/spec-reporter": "^6.1.14",
"#wdio/sync": "^6.1.14",
"chai": "^4.2.0",
"chai-webdriverio": "^1.0.0",
"chromedriver": "^83.0.0",
"local-runner": "^0.1.1-alpha",
"wdio-chromedriver-service": "^6.0.3",
"webdriverio": "^6.1.11"
Could you please help me?

The dot slash annotation is not working on Windows, as where you can just leave that part out.
Linux / MacOS
./node_modules/.bin/wdio config
Windows
node_modules/.bin/wdio config
Though, if you wanted to, you could use .\ and it would work.
.\node_modules.bin\wdio config
The explination here is the difference between the directory separators along with the path.
. = current directory
.. = parent directory
./ Mac, Linux, etc
.\ Windows, Windows 2000, etc

Related

How can I set starting directory for D: in WSL2?

I am using Ubuntu-20.04 WSL2 in Windows 10.
I want to approach D: when I open my terminal, so I added this in my workspace settings.json:
"source": "Windows.Terminal.Wsl",
"colorScheme": "Monokai Night",
"startingDirectory": "\\\\wsl$\\Ubuntu-20.04\\mnt\\d" //added this
But it is not working (this code connected me to default of mnt/c/Users/username).
So I also tried this:
"source": "Windows.Terminal.Wsl",
"colorScheme": "Monokai Night",
"startingDirectory": "\\\\wsl$\\Ubuntu-20.04\\mnt" //added this
It is working.
How can I set starting directory for d?
For mounted directories like D:, setting the mount point like /mnt/d won't work (h/t #Dominique).
Either use a Windows-style path (with backslashes escaped):
"startingDirectory": "D:\\"
Or use Linux-style slashes in newer versions (slashes do not need to be escaped):
"startingDirectory": "D:/"
– Requires Windows Terminal 1.11.2421.0 on Windows 10 21H2 or Windows 11
Alternatively, ignore the Windows Terminal settings and just cd at the end of your ~/.bashrc:
cd /mnt/d

MdlSelect - ViewDestroyedError: Attempt to use a destroyed view: detectChanges

I'm getting the same issue as mentioned in this
github issue
I'm using the following versions:
"#angular-mdl/core": "^8.0.0",
"#angular-mdl/popover": "^8.0.0",
"#angular-mdl/select": "^8.0.0",
From the issue, it seems that this was fixed in this PR and was published as #angular-mdl/select:0.11.2, but I don't see that fix in version 8.
Could you please help me out with a fix for this issue on "#angular-mdl/select": "^8.0.0"
Thanks in advance.

How to configure ESLint auto fix on save in WebStorm/PHPStorm?

I am trying to create a custom file watcher in WebStorm that will auto fix ESLint errors on save. In Settings > Tools > File Watchers I created a new file watcher with the following settings:
File type: Any
Scope: All places
Program: /home/user/Projects/todo-app/eslint-autofix.sh
Arguments: blank
Output paths to refresh: blank
Other options > Working directory: /home/user/Projects/todo-app
eslint-autofix.sh:
#!/usr/bin/env bash
./node_modules/.bin/eslint --fix
Then I made an ESLint error and pressed Ctrl + S to save. The following error pops up:
/home/user/Projects/todo-app/eslint-autofix.sh
/usr/bin/env: ‘node’: No such file or directory
How to fix this error?
According to this article, settings should be as the following:
File type: Any (or JavaScript)
Scope: Project files
Program: $ProjectFileDir$/node_modules/.bin/eslint
Arguments: --fix $FilePath$
Output paths to refresh: $FileDir$
On WebStorm 2020.1.1, there is a checkbox called Run eslint --fix on save.
Also see:
https://www.jetbrains.com/help/webstorm/eslint.html#ws_js_eslint_activate
Just to extend on jstice4all's & gotjosh's solution:
I was able to get the FileWatcher to ESLint for some projects, but it wasn't working with the plugin extends: '#react-native-community'
#react-native-community/eslint-config#overrides[2]:
Environment key "jest/globals" is unknown
Turns out that the #react-native-community plugin needs to be ran from the project folder itself in order to load the environment variables, whereas the file watcher runs from the node_module/eslint path. To get it to work I had to add the following config:
Working Directory: $ProjectFileDir$
Screenshot Config

How to create a JSCS config file on windows

When I try to create a JSCS config file:
C:\Blog\BlogWeb>jscs --auto-configure "C:\Blog\BlogWeb\temp.jscs"
I get the following error:
safeContextKeyword option requires string or array value
What parameter am I supposed to pass? What is a safecontextkeyword?
New to NPM and JSCS, please excuse ignorance.
JSCS was complaining that I didn't have a config file, so I was trying to figure out how to create one.
JSCS looks for a config file in these places, unless you manually specify it with the --config option:
jscs it will consequentially search for jscsConfig option in package.json file then for .jscsrc (which is a just JSON with comments) and .jscs.json files in the current working directory then in nearest ancestor until it hits the system root.
I fixed this by:
Create a new file named .jscsrc. Windows Explorer may not let you do this, so may need to use the command line.
Copy the following into it. It doesn't matter if this is the preset you want to use or not. The command will overwrite it.
{
"preset": "jquery",
"requireCurlyBraces": null // or false
}
Verify that it works by running a command such as:
run the command
jscs --auto-configure .jscsrc

Grunt: How to change config strings for different environments

I have a python file as part of my grunt workflow. I have defined two build tasks:
build:dev
build:release
When I compile 'build:dev', I want to add this line to my python file:
...
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + dbpath
...
When I compile 'build:release', I want to add this line to my python file:
...
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['POSTGRESQL_COLORFUL_URL']
...
edit: fixed typo in code and title
You can use grunt-sed.
It's a really useful 'find and replace' system that builds into Grunt.
From the docs:
npm install grunt-sed
Add this line to your project's Gruntfile.js:
grunt.loadNpmTasks('grunt-sed');
Then in your build:dev and build:release tasks have the following:
sed: {
database_uri: {
path: 'path_to_your_python.py',
pattern: '%PATTERN_IN_YOUR_PYTHON_FILE%',
replacement: '\'sqlite:///\' + dbpath',
}
}
In your python file you want replacing you must also have %PATTERN_IN_YOUR_PYTHON_FILE% to be replaced.
I've used a plugin called grunt-string-replace that worked very well for what I needed to do. Also, I added some custom code in my Gruntfile.js to read different environment configurations and customize the build output based on that.
I detailed the full deployment script in this post: http://dev-blog.cloud-spinners.com/2014/02/complete-grunt-deployment-workflow-for.html
I hope you find that useful.

Resources