When editing javascript files in Sublime Text Editor 3.x, I get the error:
Oops! Something went wrong! :(
ESLint: 6.0.1.
ESLint couldn't find the plugin "eslint-plugin-chai-expect".
(The package "eslint-plugin-chai-expect" was not found when loaded as a Node module from the directory "C:\workspace\flltools".)
It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
npm install eslint-plugin-chai-expect#latest --save-dev
The plugin "eslint-plugin-chai-expect" was referenced from the config file in "modules\scoring\.eslintrc.yml".
If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.
I tried multiple solutions I found online, including removing global ESLint/moving all ESLint related packages to be global, to altering the SublimeLinter.settings file. The problem only occours when running lint through Sublime. When I run eslint command, it works perfectly.
If anyone has any idea why this is happenning please help me!
Thank you
As far as I can tell this is indeed a problem with migrating to ESLint v6. But it's not a global installation problem.
The problem is now that ESLint looks in the working directory where the eslint command is run from. As you say in your comment:
It seems to be looking in a parent folder (as you can see in the error it's looking in c:/workspace/flltools, whereas my project is in c:/workspace/flltools/modules/scoring
So your editor is running eslint in the parent directory rather than in the directory where the package.json file is. I'm guessing your editor has the project root one level higher than where the package.json file is.
It does look like this has now been patched in the SublimeLinter plugin via github issue #1626: Wrong working directory on nested local eslint installs (breaks eslint#6)
Note that I have similar issues with both VSCode and Vim, so it's not a specifically a Sublime Text thing, more just an ESLint thing.
In the ESLint v6 migration doc, it has a section on "Plugins and shareable configs are no longer affected by ESLint’s location". It suggests:
If you use a config file located outside of a local project (with the --config flag), consider installing the plugins as dependencies of that config file, and setting the --resolve-plugins-relative-to flag to the location of the config file.
This --resolve-plugins-relative-to will fix the problem in that you can specify the path to where the package.json is inside there.
Most probably you have updated your ESLint to v6.
As per Migrating to 6.0 Docs
If you use a global installation of ESLint (e.g. installed with npm install eslint --global) along with plugins.
Then you should install those plugins locally in the projects where you run ESLint.
In your case, Install eslint-plugin-chai-expect and other plugins(if used) as devDependencies locally to your project.
npm install --save-dev eslint-plugin-chai-expect
If your config file extends shareable configs and/or parsers, you should ensure that those packages are installed as dependencies of the project containing the config file.
Related
For a few days I have been getting these messages:
*> yarn run v1.21.1 $ react-scripts start
There might be a problem with the project dependency tree. It is
likely not a bug in Create React App, but something you need to fix
locally.
The react-scripts package provided by Create React App requires a
dependency:
"eslint": "^6.6.0"
Don't try to install it manually: your package manager does it
automatically. However, a different version of eslint was detected
higher up in the tree:
/home/sol/Repository/node_modules/eslint (version: 6.3.0)
Manually installing incompatible versions is known to cause
hard-to-debug issues.
If you would prefer to ignore this check, add
SKIP_PREFLIGHT_CHECK=true to an .env file in your project. That will
permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact
order:
Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
Delete node_modules in your project folder.
Remove "eslint" from dependencies and/or devDependencies in the package.json file in your project folder.
Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem. If this has
not helped, there are a few other things you can try:
If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
Check if /home/sol/Repository/node_modules/eslint is outside your project directory.
For example, you might have accidentally installed something in your home folder.
Try running npm ls eslint in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed eslint.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file
in your project. That would permanently disable this preflight check
in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-)
We hope you find them helpful!
error Command failed with exit code 1. info Visit
https://yarnpkg.com/en/docs/cli/run for documentation about this
command.*
I tried everything above, but nothing helps and I'm really upset about this situation because I can't get my code to work.
Can someone help me with easy instructions because I don't have time anymore to try and find a solution to the problem.
I could not solve the problem:
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"eslint": "^6.6.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of eslint was detected higher up in the tree:
/Users/elvestrindade/node_modules/eslint (version: 6.2.2)
I am using a template, Vue cli3 application and it stopped working and I don't recall why. The error I am receiving is when I try to start the application I get this error.
yarn run serve
yarn run v1.16.0
error An unexpected error occurred: "The \"path\" argument must be of type string. Received type object".
info If you think this is a bug, please open a bug report with the information provided in "C:\\node\\TradeTriggers\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I can delete the node_modules and package.json.lock
I cannot do anything with yarn. No yarn install, yarn run serve, nothing and npm doesn't seem to want to run the application. I'm sorry there are a lot of tools to know in the JS world!
The machine is a windows10 machine and I cannot find yarn in my env variables, so the issue may lie there. I even tried installing the Yarn MSI but my version is still the one I installed through npm a while ago, still nothing.
I had problem that was caused by yarn looking at first the global settings file, ie global registry. It might be similar. On Windows, first check your yarn config path:
yarn config bin
Windows shows the path. Then in that folder, check whether you have a "rc" file, ie that is yarn configuration.
Try move this file out of the folder, for test. Have it as a copy somewhere else, where you can restore it if this does not help.
Then, once file is out, run your yarn commands again like you used to.
Sideline: on Linux, I had to remove a leftover buggy .yarnrc file in
/usr/local/share/.yarnrc
to get similar things working again. It was not a Vue app, but similar kind of error.
This error can occur when you are using Yarn Workspaces and have incompatible directories in the packages/ directory.
In my scenario, I used git subtrees to pull another repo into my project's packages/ directory. This directory had a package.json file, but it did not have compatible values for the fields required by Yarn Workspaces.
Moving the problematic package out of packages/ should fix this issue.
I used the CLI to install React Native, Node and Python but was not aware if I needed to save it to a file first.
I ran the yarn command:
➜ ~yarn add <package>
I would get this warning message when running yarn check:
➜ ~ yarn check
warning package.json: No license field
warning No license field
warning "jest-haste-map#fsevents#node-pre-gyp#^0.12.0" could be deduped from "0.12.0" to "node-pre-gyp#0.12.0"
Questions:
1. Do I only ~ yarn add when I start a project?
2. Since I've installed python, node, and react-native without creating a project folder will I run into issues down the road?
3. Do I add the json file with the licenses manually when starting a project with yarn?
4. Am I hopeless? lol
I've tried uninstalling and reinstalling from yarn and updating yarn. Also, I've tried installing python and node from Homebrew to see if that changes anything.
Below is a log of the output from the CLI after running ~ yarn check
Last login: Sat Aug 24 02:21:38 on ttys001
➜ ~ yarn check
yarn check v1.17.3
warning package.json: No license field
warning No license field
warning "jest-haste-map#fsevents#node-pre-gyp#^0.12.0" could be deduped from "0.12.0" to "node-pre-gyp#0.12.0"
success Folder in sync.
✨ Done in 1.99s.
Solution I figured it out! So after poking around I realized that once I started a project I had a yarn.lock and package.json file one level up in the directory where the file was located. What I did was I deleted yarn.lock and package.json associated with the folder in the directory. After that was complete I then went into my project and installed the correct packages.
You're not hopeless. This project may be, you've bitten off waaaay more than you can chew yet.
To answer your main question:
yarn add and it's cousin npm install will install the thing you tell them to in the node_modules folder in the directory you run the command in. The reason it's yelling at you is because usually you'll want to save the thing you installed as a dependency of your project, and you can't do that without a package.json file. You should run npm init to set up the package.json file for your project, then running yarn add will actually save it to the dependencies list so that you have a reproducible. If you have a package.json file already, it sounds like you maybe created it by hand (since it's missing a license field?) rather than have npm set it up for you, which is a bad idea.
Two more things:
React Native is awesome! ...But, it's a tool for people who already have good familiarity with Javascript command line/tooling/ecosystem/coding/React to build mobile apps. It is a lousy choice for a first project if you're just getting started with programming. Building a webpage with React is a lot easier, but even that may be too much.
If you really want to build a React Native app and you just can't wait look at this to get started.
But seriously, learn Javascript then npm then yarn then React then React Native. In that order.
I've got these plug-ins in my project
babel-traverse
babel-types
babylon
How do I update these to the latest?
Including typescript plugin.
In my node_modules folder - i've got a bunch of entries that I did not install
adm-zip
inflight
minimatch
lazy
mkdirp
and others - anyone how how it got there?
Running npm outdated shows outdated packages. npm update updates packages. And you need to check the versions listed in package.json to see if they're locked at specific version or if you allow minor/major bumps when running install. There are hundreds of tutorials on using npm and understanding the package.json. those packages you mention, I wouldn't mess with too much. those are added by nativescript to make things work in a sense. So they're dependencies for nativescript they don't actually get packaged with your app (I don't believe, haven't checked that in a build to be certain).
I want to use Karma and Jasmine to test my AngularJS application. All of the documentation I've found to install Karma and Jasmine involve using npm. I can't use npm because I am restricted, the reason doesn't matter. So far I have pulled Jasmine and Karma from Github using zip files. I want to add Karma and Jasmine to my project, but I don't think unzipping the entire contents of the respective GitHub repos is the way to go.
I'd like to know what I need to make Karma and Jasmine usable within my AngularJS project without using npm.
I guess it is possible, but will take a huuuuuge amount of work because of the dependencies. If you take a look at karma's repository, you can find a file package.json (here). In this file there is a property dependencies (link), which lists the modules karma depends on. So you'll have to find their sources, manually download all of them with respective version number and put in the folder called node_modules created in the karma module folder. But each of these modules karma depends on also has dependencies listed in their own package.json - you'll have to download them too keeping in mind version numbers and putting them in module's node_modules folder. And this dependency nesting can be really really deep.
Some modules may have extra scripts to be executed after they have been installed (scripts), which are called by NPM by default on installation. Maybe there are some other things which I am not aware of. Generally speaking it was designed to be installed via NPM and it's rarely the case when someone has no access to use it.
I would advise to ask somebody who has access to NPM to do an install of required packages and share the result of installation with you. Everything will be installed in the node_modules folder of the directory you run NPM commands from, it would be easy to do.
Here you can download version I've created, it has karma v0.13.1, karma-jasmine v0.3.6 and karma-chrome-launcher v0.2.0. I hope it will work for you, because we might have different OS (mine is Ubuntu 14.04 x64), I'm not sure if NPM does something OS-specific while installation of any package.
You should place the content of the archive to your project directory, to execute tests from your project folder use a terminal command:
./node_modules/karma/bin/karma start
I would still advise to solve the problem of accessing the NPM if you want to closely work with modules it stores.