Adding NPM module to Ember app - ember.js

I'm trying to use bootbox in my Ember app with ember-browserify. I have installed bootbox like a npm module and have added next to code:
import Bootbox from 'npm:bootbox';
Bu on compilation with ember-cli I got error:
The Broccoli Plugin: [object Object] failed with:
Error: Cannot find module 'jquery' from '/Users/Crabar/Documents/Programming/EmberDrinkIt/node_modules/bootbox'
Versions: Ember 2.2.0, EmberCLI 2.4.3

Have you tried to import the node module in the Brocfile.js?
app.import('node_modules/<path_to_module>.js');

Related

IONIC 2 - Runtime Error. Cannot find module “ionic-native”

I'm receiving this error while executing ionic 2 :
Error
Runtime Error. Cannot find module “ionic-native”.
Stack
g#localhost:8100/build/polyfills.js:3:7138
localhost:8100/build/main.js:113219:16
webpack_require#localhost:8100/build/main.js:20:34
localhost:8100/build/main.js:87074:92
webpack_require#localhost:8100/build/main.js:20:34
localhost:8100/build/main.js:135215:89
webpack_require#localhost:8100/build/main.js:20:34
localhost:8100/build/main.js:66:37 global
code#localhost:8100/build/main.js:67:12
Install below
npm install ionic-native --save
Issue may be because of ionic package up-gradation. Delete node_modules folder.
The ionic packages are changed from ionic 2.x to 3.x. You need to do following changes.
Delete reference of ionic-native from package.json.
Install ionic 3.x native packages using following commands
npm install #ionic-native/core --save
npm install #ionic-native/splash-screen --save
npm install #ionic-native/#ionic-native/status-bar --save
3. Change references of ionic 2.x native package from app.module.ts.
import { SplashScreen } from '#ionic-native/splash-screen';
import {StatusBar } from '#ionic-native/status-bar';
Add StatusBar and SplashScreen in providers array of app.module.ts
Update imports of StatusBar and SplashScreen in app.component.ts ( Just like step no. 3)
Add following in constructor of app.component.ts
statusBar: StatusBar, splashScreen: SplashScreen
7. If you are using http service, import it in app.module.ts as below:
import { HttpModule } from '#angular/http';
Add HttpModule in imports array.
Note: You may need to do same thing for the other similar native packages.
Run the following command to install Ionic Native in your project:
npm install #ionic-native --save
I solved that error changing this:
import { NavController } from 'ionic-angular/umd'
to this:
import { NavController } from 'ionic-angular'

Ember 2.11+ can't find `ember-template-compiler` after removing ember from bower

Since Ember version 2.11, it should be possible to remove ember from bower, and instead load the library using the npm ember-source module.
I've run npm install --save-dev ember-source. I've removed ember from the bower.json file, and run rm -rf bower_components/ember.
I've added ember-source to packages.json and installed it .
When I run ember serve, it fails with this message:
Cannot find module 'path/to/myapp/bower_components/ember/ember-template-compiler'
Error: Cannot find module 'path/to/myapp/bower_components/ember/ember-template-compiler'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Class.included (path/to/myapp/node_modules/ember-cli-htmlbars-inline-precompile/index.js:48:20)
at Class.superWrapper [as included] (path/to/myapp/node_modules/ember-cli/node_modules/core-object/lib/assign-properties.js:34:20)
at EmberApp.<anonymous> (path/to/myapp/node_modules/ember-cli/lib/broccoli/ember-app.js:495:15)
at Array.filter (native)
at EmberApp._notifyAddonIncluded (path/to/myapp/node_modules/ember-cli/lib/broccoli/ember-app.js:490:45)
at new EmberApp (path/to/myapp/node_modules/ember-cli/lib/broccoli/ember-app.js:140:8)
It looks like ember is trying to load ember-template-compiler from the bower module, which no longer exists. How can I tell ember that it should instead be looking for node_modules/ember-source/dist/ember-template-compiler.js?
Try updating it in package.json
"ember-cli-htmlbars-inline-precompile": "^0.3.6"
Refer https://github.com/ember-cli/ember-cli/pull/6711

can't import npm package using ember-browserify (Uncaught Error: Could not find module)

In my ember application I have installed ember-browserify by running
npm install ember-browserify --save
I have then installed pit-scheduler by running
npm install pit-scheduler --save
and then I have restarted ember but when I go to the page I get this error
Uncaught Error: Could not find module npm:pit-scheduler imported from my-app/routes/schedule
Is it because I need to also npm install all of the dependency packages somehow?
in the actual package example these are packages which are being imported
<script src="js/jquery-2.2.4.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/moment-with-locales.min.js"></script>
<script src="js/bootstrap-datetimepicker.js"></script>
<script src="../dist/js/pitscheduler.min.js"></script>
I have already installed these packages by running npm install as well but still the same issue. Any idea why that is the case?
url to the packages
https://www.npmjs.com/package/pit-scheduler
https://www.npmjs.com/package/ember-browserify
I think that pit-schedular can't be included that way to Ember. Here's what you could do, clone pit-scheduler repository in vendor folder and then import it to ember-cli-build.js from there with:
app.import('vendor/pit-scheduler/dist/js/pitscheduler.min.js');

Error while creating new ember application using ember-cli

I installed ember-cli tools, When i tried to create a new application using ember new book-app i get the following error
installing app
......
create tests/unit/.gitkeep
create vendor/.gitkeep
Successfully initialized git.
Installed packages for tooling via npm.
Error creating new application. Removing generated directory `./book-app`
Package ember not found
Error: Package ember not found
at createError (/usr/local/lib/node_modules/ember-cli/node_modules/bower/lib/util/createError.js:4:15)
at /usr/local/lib/node_modules/ember-cli/node_modules/bower/lib/core/resolverFactory.js:206:23
at _fulfilled (/usr/local/lib/node_modules/ember-cli/node_modules/bower/lib/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/ember-cli/node_modules/bower/lib/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/ember-cli/node_modules/bower/lib/node_modules/q/q.js:796:13)
at /usr/local/lib/node_modules/ember-cli/node_modules/bower/lib/node_modules/q/q.js:604:44
at runSingle (/usr/local/lib/node_modules/ember-cli/node_modules/bower/lib/node_modules/q/q.js:137:13)
at flush (/usr/local/lib/node_modules/ember-cli/node_modules/bower/lib/node_modules/q/q.js:125:13)
at nextTickCallbackWith0Args (node.js:419:9)
at process._tickCallback (node.js:348:13)
I am not sure what the problem is. I am using ember-cli 2.7.0
Since no answer was provided and I just ran in to this exact error. What worked for me was to reinstall bower.
npm rm -g bower
npm install bower -g

Issue installing addon in ember cli

I am on 0.1.4 of ember-cli and tried installing an addon:
ember install:addon ember-cli-simple-auth-cookie-store
but I got the error:
The specified command install:addon is invalid, for available options see ember help.
How can I go about installing this addon please?
Check the Installation Instructions for Ember CLI 0.1.4 and older: https://github.com/simplabs/ember-cli-simple-auth-cookie-store#installation