Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tip: Things to check if you get an npm run lint error or build error #151

Closed
3 tasks
evilcat-x opened this issue Jun 1, 2016 · 17 comments
Closed
3 tasks

Comments

@evilcat-x
Copy link

evilcat-x commented Jun 1, 2016

I am opening this issue as I also caught up in the npm run lint error issues.
After a few hours research on github issues and googling, I found the current checklist to resolve this issue.
(Note: this applies to both react-slingshot and react-redux course git repo)

  • First Make Sure .eslintrc is in your project root folder.
    The current ESW have some weird behavior in terms of reading .eslintrc. Even your .eslintrc is not in your root folder, for example, I accidentally put mine in the /tools folder, some of the setting will still be activated like parserOptions but none of the rules are valid.
  • Putting the .eslintrc in the wrong folder would lead to Parsing error: The keyword 'import' is reserved

And it is not related to the setting of your .eslintrc but whether it is in your root folder or not.
If you didn't put

"sourceType": "module", "ecmaFeatures": { "jsx": true, "modules": true }

  • Missing modules setting would lead to Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
  • Second change the npm run lint script to "esw webpack.config.* src tools; exit 0" and change the npm run lint:watch script to "esw webpack.config.* src tools --watch; exit 0"
    If ESW found any error or warning in your project like console statement or missing semi, the lint thread will be exit with Exit status 1.
    This will lead to an ELIFECYCLE error.
    This is actually not an error but a warning of ESW to indicate that it will print out all the warning and error. Adding exit 0 will not break the eslint checking but allow npm script to ignore the status 1 and allow ESW to print all all the warning and error.
  • Third check eslint/esw global install version and the local version to match.
    This is not an issue I encounter but, make sure the global install is not outdate or out-sync with local project will help you resolve the 'esw' keyword. And this means we could use esw to replace the /node_modules/.bin/esw.

These are all the issues I found regarding debugging npm run lint issues. I hope this helps a lot current unresolved opened issues. Including some closed issues with is not correctly resolved.

This include:
#133
#84
#150

Note: I did not reproduce the issue above, some my solution could be not working with the above issues but I think this is a pretty solid solution to the current version of eslint/esw/npm script.

Credit to:
modules solution
exit 0 solution

@coryhouse
Copy link
Owner

@SenLi325 Wow, great stuff. Thanks for pulling all this together! This is really comprehensive and helpful! 👍

@evilcat-x
Copy link
Author

evilcat-x commented Jun 2, 2016

Update on First check list.
Configuration Cascading and Hierarchy
The eslint use cascading and hierarchy to achieve different eslint config for each folder. So make sure you have a .eslintrc in the root folder with the correct setting and adding more in the sub-folder if your need more in-deep config.

@coryhouse coryhouse changed the title npm run lint error or build error Tip: Things to check if you get an npm run lint error or build error Jun 28, 2016
@floydnoel
Copy link

This is probably obvious to everyone except me, but it took me a bit to figure out that step 2 occurs in the package.json. That fixed my issue, so thanks!

@trickydisco78
Copy link

I've had this issue for weeks. Now fixed (on the react-redux pluralight course)

It was the path issues with eslint watch. I made sure i installed eslint watch 2.1.14 both globally and locally

@nickytonline
Copy link
Collaborator

Is anyone still having issues here or are we OK to close this? Also thanks again to @Evilcat325 for pulling this together.

@coryhouse
Copy link
Owner

I'm fine with closing, but would suggest copying any info here to here: https://github.com/coryhouse/react-slingshot#having-issues-try-these-things-first

@nickytonline
Copy link
Collaborator

@Evilcat325, would you be willing to throw up a PR to update the docs section https://github.com/coryhouse/react-slingshot/blob/master/README.md#having-issues-try-these-things-first ?

@kwelch
Copy link
Collaborator

kwelch commented Mar 30, 2017

Added help wanted label for someone to transfer this to documentation. This would also be a good-first-pr, but we didn't have a label for that.

@nickytonline
Copy link
Collaborator

@coryhouse, can you create a good first PR label? I don't think we have access to create labels.

@coryhouse
Copy link
Owner

Ah! Great idea. Done. 👍

helllth added a commit to cismet/wupp-topic-maps that referenced this issue May 10, 2017
@romarioraffington
Copy link
Contributor

Eager to get my first PR in 😃.

Is this info still valid, since we are no longer using a .eslintrc file (#405)

@coryhouse
Copy link
Owner

Great to hear @romarioraffington! Correct, you can ignore the .eslintrc tip since that's in package.json now.

@romarioraffington
Copy link
Contributor

romarioraffington commented Aug 18, 2017

How does this look @coryhouse ?

  1. Tip: Things to check if you get an npm run lint error or build error:

    • If sourceType": "module", "ecmaFeatures": { "jsx": true, "modules": true } is missing from the eslint rules then the following error will be thrown: Parsing error: 'import' and 'export' may appear only with 'sourceType: module'

    • If ESW found an error or warning in your project (e.g console statement or a missing semi-colon), the lint thread will exit with Exit status 1. To fix:

      1. Change the npm run lint script to "esw webpack.config.* src tools; exit 0"
      2. Change the npm run lint:watch script to "esw webpack.config.* src tools --watch; exit 0"

      Note: Adding exit 0 will allow the npm scripts to ignore the status 1 and allow ESW to print all warnings and errors.

    • Ensure the eslint/esw globally installed version matches the version used in the project. This will ensure the esw keyword is resolved.

@coryhouse
Copy link
Owner

Hi @romarioraffington - Thanks! I corrected a minor typo by editing your comment. Let's omit the first bullet since that code is already included in the project. but otherwise looks great. Thanks!

@coryhouse
Copy link
Owner

Closing since @romarioraffington added! 👍

coryhouse pushed a commit that referenced this issue Sep 3, 2017
* removed react-router form package.json & installed react-router-dom.

* completed index.src refactor.

* re-implemented App.js

* added notes to import changes & App.js

* modified middleware array @ store/configureStore.js

* updated yarn.lock file with fresh `yarn` command.

* updated master branch.

* upgraded react-hot-reloader to @3.0.0-beta.6

* removed extra "document.getElementById(app) from Root.js

* moved react-router-redux to regular "dependencies" from "dev-dependencies"

* cleaned Root.propTypes.

* cleaned Root.js & App.js per @oshalygin feedback.

* replaced .gitignore comment.

* removed react-router form package.json & installed react-router-dom.

* completed index.src refactor.

* re-implemented App.js

* added notes to import changes & App.js

* Update FAQ.md

fixed header on FAQ page

* Update README.md

fixed a few headers improperly declared

* modified middleware array @ store/configureStore.js

* Add react hot loader 3 (#392)

- This commit wires up react-hot-loader 3 to
  be used in the application.  There are numerous
  benefits to the latest release, all of which
  can be seen at https://github.com/gaearon/react-hot-loader
- Note that the specific implementation around
  wrapping in a Root component is part of how
  react-hot-loader 3 needs to be configured.
- Note that the package is brought in as a
  dependency, not a dev dependency because of
  how it is switched at runtime or not.
- More information on the migration can be
  viewed at:
https://github.com/gaearon/react-hot-loader/tree/master/docs\#migration-to-30

Related: #216

* Updated react-hot-loader to correct package version. (#401)

* Add item to check if issues

* updated yarn.lock file with fresh `yarn` command.

* Fix formatting (#403)

* updated master branch.

* upgraded react-hot-reloader to @3.0.0-beta.6

* removed extra "document.getElementById(app) from Root.js

* moved react-router-redux to regular "dependencies" from "dev-dependencies"

* cleaned Root.js & App.js per @oshalygin feedback.

* replaced .gitignore comment.

* clean index.js

* Add CONTRIBUTE.md (#431)

* Add

* Updated yarn lock using upgrade

* Rename

* Update

* Upgrade to webpack 3

* Update yarn lock

* Update snapshot

* Set prod env when analyzing bundle

* Add jest-cli as dependency

* Revert PR #450 (#451)

Removed change that removed additional dashes in npm test scripts in favor of adding jest-cli as a devDep.

This commit instead focusses on issue 2 from #449 where setupPrompts.js had a bug that caused start script to fail.

* Issue #449 fix (#450)

* Issue #449 fix

Issue 1:
Removed extra dashes located in the package.json test scripts that cause start script to fail.

Issue 2:
Removed escape characters found in setupPrompts.js which cause linting to fail, thus breaking start script.

* Jest fix

Re-added previously removed dashes from test scripts in package.json that caused start script to fail. Instead, @coryhouse added in jest-cli as a dev-dep which resolves the issue.

* Enhance babel env config to transpile for IE9+ (#452)

* Fix for jest handling of static assets when running tests. See: (#457)

jestjs/jest#2663 (comment)

* Added tips for npm run lint and build errors (#151) (#460)

* pushing changes from upstream fetch.

* updated from rebase.

* modified package versions in package.json & created new build.

* update package.json

* fixed conflicts with upstream master.

* cleaned up PropTypes validations - react-router-redux throwing PropTypes error.

* comment spell check & de-console on Root.js
@piotrtrojanowski
Copy link

This lint thing does not work for me on Windows... Even if I applied all the suggestions. I just ignore it for the time being... In general this is why it is difficult for me to start with all these tools: versioning nightmare + completely unreadable error messages... We are still in medieval when it comes to building software! :)

esw webpack.config.* src buildScripts --color; exit 0
npm ERR! code ELIFECYCLE
npm ERR! errno 1

@richierockskool
Copy link

Build and Link 16x Fails? after all updates, 18x and 20x are good, why?

4_Install dependencies.txt
2023-12-29T22:36:36.3178170Z ##[group]Run npm install
2023-12-29T22:36:36.3178820Z �[36;1mnpm install�[0m
2023-12-29T22:36:36.3315770Z shell: /bin/bash -e {0}
2023-12-29T22:36:36.3316220Z ##[endgroup]
2023-12-29T22:36:37.0498460Z npm WARN EBADENGINE Unsupported engine {
2023-12-29T22:36:37.0500260Z npm WARN EBADENGINE package: '[email protected]',
2023-12-29T22:36:37.0501670Z npm WARN EBADENGINE required: { node: '^18.17.0 || >=20.5.0', homebridge: '>=1.7' },
2023-12-29T22:36:37.0503240Z npm WARN EBADENGINE current: { node: 'v16.20.2', npm: '8.19.4' }
2023-12-29T22:36:37.0504070Z npm WARN EBADENGINE }
2023-12-29T22:36:37.0521690Z npm WARN EBADENGINE Unsupported engine {
2023-12-29T22:36:37.0523020Z npm WARN EBADENGINE package: '[email protected]',
2023-12-29T22:36:37.0525190Z npm WARN EBADENGINE required: { node: '^18.15.0 || ^20.7.0' },
2023-12-29T22:36:37.0526340Z npm WARN EBADENGINE current: { node: 'v16.20.2', npm: '8.19.4' }
2023-12-29T22:36:37.0527580Z npm WARN EBADENGINE }
2023-12-29T22:36:37.0528850Z npm WARN EBADENGINE Unsupported engine {
2023-12-29T22:36:37.0530070Z npm WARN EBADENGINE package: '[email protected]',
2023-12-29T22:36:37.0531180Z npm WARN EBADENGINE required: { node: '^18.17.0 || >=20.5.0' },
2023-12-29T22:36:37.0532320Z npm WARN EBADENGINE current: { node: 'v16.20.2', npm: '8.19.4' }
2023-12-29T22:36:37.0533570Z npm WARN EBADENGINE }
2023-12-29T22:36:51.0445300Z npm ERR! code 1
2023-12-29T22:36:51.0447930Z npm ERR! path /Users/runner/work/homebridge-inkbird-wifi-gateway/homebridge-inkbird-wifi-gateway/node_modules/@abandonware/noble
2023-12-29T22:36:51.0465950Z npm ERR! command failed
2023-12-29T22:36:51.0478730Z npm ERR! command sh -c -- node-gyp-build
2023-12-29T22:36:51.0480620Z npm ERR! gyp info it worked if it ends with ok
2023-12-29T22:36:51.0493350Z npm ERR! gyp info using [email protected]
2023-12-29T22:36:51.0496460Z npm ERR! gyp info using [email protected] | darwin | x64
2023-12-29T22:36:51.0500210Z npm ERR! gyp info find Python using Python version 3.12.1 found at "/usr/local/bin/python3"
2023-12-29T22:36:51.0502440Z npm ERR! gyp http GET https://nodejs.org/download/release/v16.20.2/node-v16.20.2-headers.tar.gz
2023-12-29T22:36:51.0504510Z npm ERR! gyp http 200 https://nodejs.org/download/release/v16.20.2/node-v16.20.2-headers.tar.gz
2023-12-29T22:36:51.0506190Z npm ERR! gyp http GET https://nodejs.org/download/release/v16.20.2/SHASUMS256.txt
2023-12-29T22:36:51.0508780Z npm ERR! gyp http 200 https://nodejs.org/download/release/v16.20.2/SHASUMS256.txt
2023-12-29T22:36:51.0510540Z npm ERR! gyp info spawn /usr/local/bin/python3
2023-12-29T22:36:51.0511780Z npm ERR! gyp info spawn args [
2023-12-29T22:36:51.0516180Z npm ERR! gyp info spawn args '/Users/runner/hostedtoolcache/node/16.20.2/x64/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
2023-12-29T22:36:51.0517920Z npm ERR! gyp info spawn args 'binding.gyp',
2023-12-29T22:36:51.0518740Z npm ERR! gyp info spawn args '-f',
2023-12-29T22:36:51.0519820Z npm ERR! gyp info spawn args 'make',
2023-12-29T22:36:51.0520590Z npm ERR! gyp info spawn args '-I',
2023-12-29T22:36:51.0522810Z npm ERR! gyp info spawn args '/Users/runner/work/homebridge-inkbird-wifi-gateway/homebridge-inkbird-wifi-gateway/node_modules/@abandonware/noble/build/config.gypi',
2023-12-29T22:36:51.0525100Z npm ERR! gyp info spawn args '-I',
2023-12-29T22:36:51.0526780Z npm ERR! gyp info spawn args '/Users/runner/hostedtoolcache/node/16.20.2/x64/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
2023-12-29T22:36:51.0528250Z npm ERR! gyp info spawn args '-I',
2023-12-29T22:36:51.0530070Z npm ERR! gyp info spawn args '/Users/runner/Library/Caches/node-gyp/16.20.2/include/node/common.gypi',
2023-12-29T22:36:51.0531490Z npm ERR! gyp info spawn args '-Dlibrary=shared_library',
2023-12-29T22:36:51.0532450Z npm ERR! gyp info spawn args '-Dvisibility=default',
2023-12-29T22:36:51.0533860Z npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/runner/Library/Caches/node-gyp/16.20.2',
2023-12-29T22:36:51.0535950Z npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/runner/hostedtoolcache/node/16.20.2/x64/lib/node_modules/npm/node_modules/node-gyp',
2023-12-29T22:36:51.0538940Z npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/runner/Library/Caches/node-gyp/16.20.2/<(target_arch)/node.lib',
2023-12-29T22:36:51.0542010Z npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/runner/work/homebridge-inkbird-wifi-gateway/homebridge-inkbird-wifi-gateway/node_modules/@abandonware/noble',
2023-12-29T22:36:51.0543930Z npm ERR! gyp info spawn args '-Dnode_engine=v8',
2023-12-29T22:36:51.0544870Z npm ERR! gyp info spawn args '--depth=.',
2023-12-29T22:36:51.0545740Z npm ERR! gyp info spawn args '--no-parallel',
2023-12-29T22:36:51.0546670Z npm ERR! gyp info spawn args '--generator-output',
2023-12-29T22:36:51.0547550Z npm ERR! gyp info spawn args 'build',
2023-12-29T22:36:51.0579660Z npm ERR! gyp info spawn args '-Goutput_dir=.'
2023-12-29T22:36:51.0580430Z npm ERR! gyp info spawn args ]
2023-12-29T22:36:51.0581080Z npm ERR! Traceback (most recent call last):
2023-12-29T22:36:51.0583160Z npm ERR! File "/Users/runner/hostedtoolcache/node/16.20.2/x64/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 42, in
2023-12-29T22:36:51.0584660Z npm ERR! import gyp # noqa: E402
2023-12-29T22:36:51.0585240Z npm ERR! ^^^^^^^^^^
2023-12-29T22:36:51.0586950Z npm ERR! File "/Users/runner/hostedtoolcache/node/16.20.2/x64/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 9, in
2023-12-29T22:36:51.0588470Z npm ERR! import gyp.input
2023-12-29T22:36:51.0590190Z npm ERR! File "/Users/runner/hostedtoolcache/node/16.20.2/x64/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in
2023-12-29T22:36:51.0591870Z npm ERR! from distutils.version import StrictVersion
2023-12-29T22:36:51.0592830Z npm ERR! ModuleNotFoundError: No module named 'distutils'
2023-12-29T22:36:51.0594180Z npm ERR! gyp ERR! configure error
2023-12-29T22:36:51.0594960Z npm ERR! gyp ERR! stack Error: gyp failed with exit code: 1
2023-12-29T22:36:51.0597100Z npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/Users/runner/hostedtoolcache/node/16.20.2/x64/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:284:16)
2023-12-29T22:36:51.0600060Z npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
2023-12-29T22:36:51.0601530Z npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
2023-12-29T22:36:51.0602690Z npm ERR! gyp ERR! System Darwin 21.6.0
2023-12-29T22:36:51.0605080Z npm ERR! gyp ERR! command "/Users/runner/hostedtoolcache/node/16.20.2/x64/bin/node" "/Users/runner/hostedtoolcache/node/16.20.2/x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
2023-12-29T22:36:51.0608100Z npm ERR! gyp ERR! cwd /Users/runner/work/homebridge-inkbird-wifi-gateway/homebridge-inkbird-wifi-gateway/node_modules/@abandonware/noble
2023-12-29T22:36:51.0610350Z npm ERR! gyp ERR! node -v v16.20.2
2023-12-29T22:36:51.0611190Z npm ERR! gyp ERR! node-gyp -v v9.1.0
2023-12-29T22:36:51.0611760Z npm ERR! gyp ERR! not ok
2023-12-29T22:36:51.0612110Z
2023-12-29T22:36:51.0612510Z npm ERR! A complete log of this run can be found in:
2023-12-29T22:36:51.0616780Z npm ERR! /Users/runner/.npm/_logs/2023-12-29T22_36_36_654Z-debug-0.log
2023-12-29T22:36:51.0650830Z ##[error]Process completed with exit code 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants