0
votes

Preparation:

  1. install ember npm install ember-cli
  2. start a new project: ember new ember-demo

Now, lets try to remove any plugin (I have tried to remove ember-cli-jshint and ember-welcome-page) and we will get broken ember project, any call to ember utility will cause an error:

Error: Cannot find module 'ember-try-config'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/user/projects/ember-demo/node_modules/ember-cli/node_modules/ember-try/lib/utils/config.js:7:34)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)

Here is my environment:

host@user $ ember --version  --verbose
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
ember-cli: 2.6.2
http_parser: 2.7.0
node: 5.11.1
v8: 4.6.85.31
uv: 1.8.0
zlib: 1.2.8
ares: 1.10.1-DEV
icu: 56.1
modules: 47
openssl: 1.0.2h
os: linux x64

PREVIOUS PROBLEM

Previously, I wanted to use eslint instead of jshint in ember app. I just followed instructions from ember-cli-eslint github page, and run this two commands:

npm uninstall --save-dev ember-cli-jshint
ember install ember-cli-eslint

After this my project have turned into a pumpkin: no one ember command doesn't work, throwing an error (see above)

If you will skip the uninstall step - you won't get a pumpkin)) in this case ember continues to work as expected, but eslint won't be a default project's linting tool.

DOES ANYBODY KNOW, how to remove unused/unwanted dependencies from ember project carefully?

2

2 Answers

0
votes

According error message troubles caused with ember-try addon (https://github.com/ember-cli/ember-try ) which run tests on different environments ( check your package.json / node_modules )

If so - you can remove it or just add config file config/ember-try.js like ( https://github.com/vvscode/js--ember-cli-ajax-logger/blob/master/config/ember-try.js ) which define on which versions of ember you want run your tests

0
votes

There is an open issue on github ember-cli/ember-cli#6016. So my current workaround:

  1. create new ember app
  2. run ember install ember-cli-eslint
  3. remove ember-cli-jshint from package.json
  4. remove ./.jshintrc and ./tests/.jshintrc
  5. remove local node modules rm -rm ./node_modules
  6. reinstall node modules: npm install

DONE!

Also, there is pretty-well detailed description of installation of the eslint for ember: https://github.com/ember-cli/ember-cli-eslint#user-content-disabling-jshint