“unexpected token import” in Nodejs5 and babel?

In js file, i used import to instead of require import co from ‘co’; And tried to run it directly by nodejs since it said import is ‘shipping features’ and support without any runtime flag (https://nodejs.org/en/docs/es6/), but i got an error import co from ‘co’; ^^^^^^ SyntaxError: Unexpected token import Then i tried to use … Read more

How to display the app version in Angular?

How do I display the app version in angular application? the version should be taken from package.json file { “name”: “angular-app”, “version”: “0.0.1”, … } In angular 1.x, I have this html: <p><%=version %></p> In angular, this is not rendered as version number, but instead just printed as it is (<%=version %> instead of 0.0.1). … Read more

How do I add a custom script to my package.json file that runs a javascript file?

I want to be able to execute the command script1 in a project directory that will run node script1.js. script1.js is a file in the same directory. The command needs to be specific to the project directory, meaning that if I send someone else the project folder, they will be able to run the same … Read more

Do I need both package-lock.json and package.json?

After updating my NPM to the latest version (from 3.X to 5.2.0) and running npm install on an existing project, I get an auto-created package-lock.json file. I can tell package-lock.json gives me an exact dependency tree as opposed to package.json. From that info alone, it seems like package.json is redundant and not needed anymore. Are … Read more

How to use private Github repo as npm dependency

How do I list a private Github repo as a “dependency” in package.json? I tried npm’s Github URLs syntaxes like ryanve/example, but doing npm install in the package folder gives “could not install” errors for the private dependencies. Is there a special syntax (or some other mechanism) for depending on private repos? 6 Answers 6

Field ‘browser’ doesn’t contain a valid alias configuration

I’ve started using webpack2 (to be precise, v2.3.2) and after re-creating my config I keep running into an issue I can’t seem to solve I get (sorry in advance for ugly dump): ERROR in ./src/main.js Module not found: Error: Can’t resolve ‘components/DoISuportIt’ in ‘[absolute path to my repo]/src’ resolve ‘components/DoISuportIt’ in ‘[absolute path to my … Read more

npm install private github repositories by dependency in package.json

I’m trying to install github private repository by npm that includes other private github repositories as dependency. Have tried a lot of ways and posts but none is working. Here is what i’m doing : npm install git+https://github.com/myusername/mygitrepository.git in package.json is like : “dependencies”: { “repository1name”: “git+https://github.com/myusername/repository1.git”, “repository2name”: “git+https://github.com/myusername/repository2.git” } What is the the right … Read more

How do I decide whether @types/* goes into `dependencies` or `devDependencies`?

I use TypeScript 2 in my project. I’d like to use some js library, but also typings for that library. I can install types with simple npm install @types/some-library. I’m not sure if I should –save or –save-dev them. It seems to me that even DefinetelyTyped GitHub readme kind of mentions both versions, but never … Read more