I tried to start development server using npm start
all installation procedures were according to mentioned on https://facebook.github.io/react-native/docs/getting-started
I am getting error as following :
Looking for JS files in /home/akash/appme
Loading dependency graph...internal/fs/watchers.js:173
throw error;
^
Error: ENOSPC: System limit for number of file watchers reached, watch '/home/akash/appme/node_modules/jest-jasmine2/node_modules'
at FSWatcher.start (internal/fs/watchers.js:165:26)
at Object.watch (fs.js:1270:11)
at NodeWatcher.watchdir (/home/akash/appme/node_modules/sane/src/node_watcher.js:159:22)
at Walker.<anonymous> (/home/akash/appme/node_modules/sane/src/common.js:109:31)
at Walker.emit (events.js:200:13)
at /home/akash/appme/node_modules/walker/lib/walker.js:69:16
at go$readdir$cb (/home/akash/appme/node_modules/graceful-fs/graceful-fs.js:162:14)
at FSReqCallback.oncomplete (fs.js:153:23) {
errno: -28,
syscall: 'watch',
code: 'ENOSPC',
path: '/home/akash/appme/node_modules/jest-jasmine2/node_modules',
filename: '/home/akash/appme/node_modules/jest-jasmine2/node_modules'
}
Itβs hitting your system's file watchers limit
Try echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Source : https://github.com/gatsbyjs/gatsby/issues/11406#issuecomment-458769756
In VSCode try edit setting.json
File --> Preferences --> Settings --> OpenSettings
and exclude specific workspace directories, eg
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/*/**": true
}
source: https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc
Related
I'm using the PHPLint NPM package with Gulp but am getting a PHP error when I run it. When I run the failed command with PHP, I do not receive the error.
The task runs successfully without any errors in the files I'm linting, so I can't think of issues with gulp.
php.ini has error reporting enabled:
error_reporting = E_ALL
display_errors = On
Command using PHPLint:
$ gulp phplint
[17:38:24] Using gulpfile C:\laragon\www\wp\wp-content\plugins\wp-plugin-jumpstart\gulpfile.js
[17:38:24] Starting 'phplint'...
[17:38:24] 'phplint' errored after 102 ms
[17:38:24] Error: Command failed: php -d display_errors=1 -l classes/Get_Started.php
at ChildProcess.exithandler (node:child_process:397:12)
at ChildProcess.emit (node:events:390:28)
at ChildProcess.emit (node:domain:537:15)
at maybeClose (node:internal/child_process:1064:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
at Process.callbackTrampoline (node:internal/async_hooks:130:17)
Running that failed command through PHP:
$ php -d display_errors=1 -l classes/Get_Started.php
Parse error: syntax error, unexpected 'class' (T_CLASS) in classes/Get_Started.php on line 5
Errors parsing classes/Get_Started.php
gulp.js
gulp.task('phplint', function (cb) {
phplint(['**/*.php', '!vendor/**', '!node_modules/**'], { limit: 10 }, function (err, stdout, stderr) {
if (err) {
cb(err);
process.exit(1);
}
cb();
console.log('PHP Linted Successfully');
});
});
After creating a new eslint-plugin for a custom rule, vue-cli-service build fails (eslint works as expected, when triggered by ./node_modules/.bin/eslint --ext .js,.vue,.json ./ --max-warnings=0).
GitHub repository reproducing issue
Starting in an environment with a working vue-cli-service build, following the simplified instructions at https://blog.webiny.com/create-custom-eslint-rules-in-2-minutes-e3d41cb6a9a0, also reproduces the issue. Running vue-cli-service build after every step, it starts failing after step 4: yarn add --dev file:./eslint, and the build still fails after all the steps are completed.
Error message:
ERROR Failed to compile with 32 errors
Module build failed (from ./node_modules/#vue/cli-plugin-eslint/node_modules/eslint-loader/index.js):
TypeError: eslint.CLIEngine is not a constructor
at Object.module.exports (MYPATH/node_modules/#vue/cli-plugin-eslint/node_modules/eslint-loader/index.js:223:27)
***repeats 31 more times***
You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
ERROR Build failed with errors.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
vue-cli-service build stills fails after running yarn install, which says it is already up to date.
Most results for this specific TypeError: eslint.CLIEngine is not a constructor error claim the user should upgrade their JetBrains IDE. However, I am running vue-cli-service build on the command line and not using JetBrains.
The code referred to by the error message is (with preceding context):
MYPATH/node_modules/#vue/cli-plugin-eslint/node_modules/eslint-loader/index.js
...
var config = assign(
// loader defaults
{
cacheIdentifier: JSON.stringify({
"eslint-loader": pkg.version,
eslint: eslintVersion || "unknown version"
}),
eslintPath: "eslint"
},
userOptions
);
if (typeof config.formatter === "string") {
try {
config.formatter = require(config.formatter);
if (
config.formatter &&
typeof config.formatter !== "function" &&
typeof config.formatter.default === "function"
) {
config.formatter = config.formatter.default;
}
} catch (_) {
// ignored
}
}
var cacheDirectory = config.cache;
var cacheIdentifier = config.cacheIdentifier;
delete config.cacheIdentifier;
// Create the engine only once per config
var configHash = objectHash(config);
if (!engines[configHash]) {
var eslint = require(config.eslintPath);
engines[configHash] = new eslint.CLIEngine(config); //Error happens here
}
...
Edit: I upgraded #vue/cli-plugin-eslint from version 3.11.0 to 4.1.2 by editing yarn's package.json, at the suggestion of #DelenaMalan below. The build still fails with error:
ERROR Failed to compile with 1 errors 7:51:01 PM
Module build failed (from ./node_modules/#vue/cli-service/node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
eslint.CLIEngine is not a constructor
at PoolWorker.fromErrorObj (MYPATH/node_modules/#vue/cli-service/node_modules/thread-loader/dist/WorkerPool.js:262:12)
at MYPATH/node_modules/#vue/cli-service/node_modules/thread-loader/dist/WorkerPool.js:204:29
at mapSeries (MYPATH/node_modules/neo-async/async.js:3625:14)
at PoolWorker.onWorkerMessage (MYPATH/node_modules/#vue/cli-service/node_modules/thread-loader/dist/WorkerPool.js:170:35)
at readBuffer (MYPATH/node_modules/#vue/cli-service/node_modules/thread-loader/dist/WorkerPool.js:152:14)
at Object.module.exports (MYPATH/node_modules/#vue/cli-plugin-eslint/node_modules/eslint-loader/index.js:223:27)
You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
ERROR Build failed with errors.
error Command failed with exit code 1.
Edit 2:
I deleted and reinstalled the node modules on the repro linked here, as recommended by #CGundlach, but I still have the eslint.CLIEngine is not a constructor error
Annas-MacBook-Pro:eslint-test-project anna$ rm -rf node_modules/
Annas-MacBook-Pro:eslint-test-project anna$ yarn install
yarn install v1.21.1
[1/4] π Resolving packages...
[2/4] π Fetching packages...
[3/4] π Linking dependencies...
warning "#vue/eslint-config-airbnb > eslint-import-resolver-webpack#0.11.1" has unmet peer dependency "webpack#>=1.11.0".
[4/4] π¨ Building fresh packages...
β¨ Done in 14.14s.
Annas-MacBook-Pro:eslint-test-project anna$ yarn build
yarn run v1.21.1
$ vue-cli-service build
β Building for production...
ERROR Failed to compile with 1 errors 12:28:32 PM
Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
eslint.CLIEngine is not a constructor
at PoolWorker.fromErrorObj (/Users/anna/projects/yarn-vue-eslint/eslint-test-project/node_modules/thread-loader/dist/WorkerPool.js:262:12)
at /Users/anna/projects/yarn-vue-eslint/eslint-test-project/node_modules/thread-loader/dist/WorkerPool.js:204:29
at mapSeries (/Users/anna/projects/yarn-vue-eslint/eslint-test-project/node_modules/neo-async/async.js:3625:14)
at PoolWorker.onWorkerMessage (/Users/anna/projects/yarn-vue-eslint/eslint-test-project/node_modules/thread-loader/dist/WorkerPool.js:170:35)
at readBuffer (/Users/anna/projects/yarn-vue-eslint/eslint-test-project/node_modules/thread-loader/dist/WorkerPool.js:152:14)
at Object.module.exports (/Users/anna/projects/yarn-vue-eslint/eslint-test-project/node_modules/eslint-loader/index.js:223:27)
You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
ERROR Build failed with errors.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Make sure all warnings are resolved when you run either npm ci, npm i or yarn install. For me the following warnings were showed after doing a fresh install:
$ vue-cli-service build
β § Building for production...
ERROR Failed to compile with 1 error 20:47:55
Syntax Error: Thread Loader (Worker 0)
eslint.CLIEngine is not a constructor
You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
When I did a fresh install and resolved the peer dependency issue by decreasing my eslint version everything works as expected.
So try to downgrade your eslint dependency to the correct version. For me I had to downgrade to eslint < 7.0.0.
npm i -D eslint#6.8.0
# or yarn
yarn add -D eslint#6.8.0
This error starting showing up all of a sudden.
Node : v10.16.3
React native : 0.60.5
react-native-cli: 2.0.1
bundling failed: Error: Unable to resolve module stream from /Users/username/React Native/SampleApp/node_modules/browser-stdout/index.js: Module stream does not exist in the Haste module map
It's giving error for this line :
var WritableStream = require('stream').Writable
I tried installing 'stream' via npm
npm install stream
Then other similar errors started showing up.
One option is to use the client package readable-stream. If dependencies are requiring stream, then i would suggest adding the following to your babel config as well.
yarn add readable-stream
yarn add -D babel-plugin-rewrite-require
babel.config.js
module.exports = {
// rest of config
plugins: [
// other plugins
[
'babel-plugin-rewrite-require',
{
aliases: {
stream: 'readable-stream',
},
},
],
],
};
just install stream using npm install stream and run the project again.
I've created a repo I want to be cloned
after cloning, you run npm install
How do I echo a log message to the terminal that will show up at the end of the installation?
In your case, you can add a post-install script, that outputs, for example, a string to the console if you mark a version as alpha.
package.json
{
"version": "1.2.3-alpha.2",
"scripts": {
"postinstall": "node postinstall.js"
}
}
postinstall.js
const package = require('./package.json')
console.log('End of installation');
//Example using properties from package.json
if (package.version.includes('alpha')) {
console.log('Warning: Alpha version!')
}
BONUS
Append this to the command --loglevel verbose and all logs will be saved to npm-debug.log in current working directory.
It will show the logs in realtime + saves the log to directory its running.
You can just edit npm config npm config edit and add loglevel=verbose
The Express type definitions for Typescript 2.0 result in unexpected errors when executing after running npm install #types/express and tsc -t ES6 for ES6. The code compiles fine without the ES6 flag. Can anyone explain? I also have issues with other type definitions such as ssh2.
Here are the steps to reproduce:
> mkdir humbug
> cd humbug
> touch blank.ts
> tsc blank.ts
> tsc -t ES6 .\blank.ts
Everything is fine so far.
> npm init .
...
> npm install #types/express
Things start going bad now
> tsc blank.ts
> tsc -t ES6 .\blank.ts
node_modules/#types/express/index.d.ts(16,30): error TS2307: Cannot find module 'serve-static'.
node_modules/#types/serve-static/index.d.ts(16,20): error TS2307: Cannot find module 'mime'.
Ok, well I better make sure that the types for serve-static and mime are installed.
> npm install #types/serve-static #types/mime
humbug#1.0.0 C:\Users\me\Desktop\humbug
`-- (empty)
npm WARN humbug#1.0.0 No description
npm WARN humbug#1.0.0 No repository field.
npm ERR! code 1
Weird I got an ERR! code but the types were downloaded, Lets try compiling again
> tsc blank.ts
> tsc -t ES6 .\blank.ts
node_modules/#types/express/index.d.ts(16,30): error TS2307: Cannot find module 'serve-static'.
node_modules/#types/serve-static/index.d.ts(16,20): error TS2307: Cannot find module 'mime'.
Same error as last time.
My Environment:
Windows 10
Node v6.6.0
TSC 2.0.3
Other definitions with the same problem:
node_modules/#types/cors/index.d.ts(9,26): error TS2307: Cannot find module 'express'.
node_modules/#types/multer/index.d.ts(6,26): error TS2307: Cannot find module 'express'.
node_modules/#types/ssh2/index.d.ts(26,8): error TS2307: Cannot find module 'ssh2-streams'.
I am still learning all this stuff (being .NET programmer), but I had similar issue this afternoon and this configuration seem to be working:
{
"compilerOptions": {
"module": "system",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"moduleResolution": "node",
"sourceMap": true,
"typeRoots": [ "node_modules/#types" ]
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"node_modules/#types",
"**/*.spec.ts"
]
}