I'm using meteor. I'd like to use redux-undo to develope
I have installed like this
meteor npm install redux-undo
And use
import undoable, { ActionCreators } from 'redux-undo';
The meteor always shows this errors
Cannot find module 'redux-undo'
However, I install the redux module and import as above, it works well. :(
Some one help me, thanks so much!
Related
So, I'm making a small chat tool using react-chat-elements as UI library for chat components. I'd like to modify certain CSS values to match what I want to build without being tied to that specific library the way it is now (it hasn't been updated since 5 months ago).
So what I tried is fork it to my Github account, created the NPM package from it (react-chat-elements-av) without making any changes first to make sure it worked the same way as with the original. However, when I import a specific component from the NPM package I created, say import { MessageBox, SystemMessage } from "react-chat-elements-av";, I get an error saying Attempted import error: 'MessageBox' is not exported from 'react-chat-elements-av'., being the attempted import location: /node_modules/react-chat-elements-av/index.
Now, if I import those two components from the original NPM package, import { MessageBox, SystemMessage } from "react-chat-elements";, everything works and the import location is a bit different: /node_modules/react-chat-elements/dist/main.
Is there something I'm missing on the creation of that dist directory when doing npm install react-chat-elements-av? I literally forked the original repo, and created the NPM package with it, no changes made to any webpack config or so.
Any idea what could be happening here?
Thanks in advance!
The dist repository is for production grade code after it has been built. It's the distribution file. try seeing how they have built their library by running npm run build once you've downloaded it.
I am trying to use the moment-timezone npm package in my meteor app to no avail. If I use the atmosphere package, everything runs just fine. However I would like to get the npm package running as the atmosphere one is no longer being maintained. I have removed the atmosphere package completely from the app before trying to get it running via npm.
When I run meteor npm list --tree, towards the bottom the moment-timezone package and its dependency appear:
└─┬ moment-timezone#0.5.23
└── moment#2.22.2
and meteor npm install gives:
audited 107 packages in 1.913s
found 0 vulnerabilities
In the file where I'm using moment-timezone I have
import moment from 'moment-timezone';
But the javascript console shows it is failing on the import of both moment and moment-timezone:
SyntaxError: Unexpected identifier 'moment'. import call expects
exactly one argument.
Following the console error, these two lines in two separate files are highlighted in red
import moment from 'moment';
import moment from 'moment-timezone';
So it looks to me that it isn't able to resolve the packages, but it appears as if they have been installed correctly and meteor npm install has worked fine.
The app is meteor 1.8
I'm out of ideas - any help would be greatly appreciated!
Cheers
In ES6 use like below
import moment from 'moment';
import 'moment-timezone';
here is you can see Timezone Support
The error 'Unexpected identifier' implies that the import lines haven't been transpiled and your browser doesn't understand them. Have you added the ecmascript atmosphere package to your project?
Once you've added it, the only import you should need is:
import moment from 'moment-timezone';
We've started to build an application and came to decide we want to integrate it with office-ui-fabric-react. I know how to install packages using npm ..., I just have no idea where to install both NodeJs & gulp.
I have a repository called Relationize, in that repository I have a folder to my Api and to my web application(here is also my package-lock.json located).
In here I don't know if it should either be in the root where my project file is or in my wwwroot (as said it should be in your root). But when I ran all 3 commands: npm i -S nodejs, npm install --global gulp-cli and eventually npm --save install office-ui-fabric-react to install the office package.
When I try to add a component in a seperate javascript file to just test if it works(just copied the code from #Microsoft:
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Fabric } from 'office-ui-fabric-react/lib/Fabric';
import { DefaultButton } from 'office-ui-fabric-react/lib/Button';
const MyPage = () => (<Fabric><DefaultButton>I am a button.</DefaultButton></Fabric>);
ReactDOM.render(<MyPage />, document.body.firstChild);
It gives an error:
Uncaught SyntaxError: Unexpected token import
Does anyone have an understandable guide on how to implement this in an existing project or someone who wants to spend some time helping me to implement it?
Thanks in advance!
Perhaps you are missing the ecosystem of build tools to transform your js file into something that is understood by your browser e.g. babel, webpack and the like? It's possible that your browser understands the latest module syntax though...
There is a good example program at: https://medium.com/#gmonne/simple-app-layout-with-office-ui-fabric-react-2eac6361e1b4. There are other examples.
I have just build my first npm package. It is a small utility for helping me manage logins on hobby projects.
In v0.0.2 of this package I had an import that looked like this:
import { setRoute } from 'actions/route-actions';
Which did not work so i changed it to this
import { setRoute } from 'auth-hub-module/lib/actions/route-actions';
However when I try to install the new version (0.0.4) in my other projects I keep getting the import from version 0.0.2.
Why is this? How Can I debug this?
My build script works fine when I am in the package repo and the files being built there has the correct path.
I tried uninstalling and reinstalling the package in the project with no luck.
I'm pretty new to some of this stuff and I feel like I must just be missing something simple. I have a very basic Ember.js app that I created with the CLI tool flowing the guide. The code is at https://github.com/nfriedly/particle-webhook-manager
It has a couple of routes and components, and a single third-party dependency, particle-api-js. I installed it twice, via bower and npm, and I'm importing it in one of my components like so:
import particle from 'particle-api-js';
I start up my server with ember serve and it builds successfully. I then open my browser to http://localhost:4200/login where I load the component and it gives me the following error in my console:
Error: Could not find module `particle-api-js` imported from `particle-webhook-manager/components/login-form`
So, my main question is: what am I doing wrong here/how do I make it work?
My secondary question is: why did it "build" successfully and then throw a runtime error for the missing module - shouldn't it have found that in the build stage?
You should not use bower anymore. Use ember browserify to import things installed with npm.
You can import bower modules in your ember-cli-build.js with app.import('bower_components/...js').
You can not import them directly, but you can create a vendor shim to provide this for you. Checkout the ember-cli documentation for this.