package.json

How to add multiple NODE_PATH in package.json?

橙三吉。 提交于 2019-12-07 00:54:18
问题 How do I add multiple NODE_PATH in package.json? I want to have these multiple paths: NODE_PATH=./ NODE_PATH=./modules/ or NODE_PATH=./lib NODE_PATH=./modules/ package.json: { "name": "my-app", "description": "env", "repository": "https://github.com/xxx.git", "scripts": { "dev": "NODE_PATH=./lib NODE_PATH=./ node server.js", "start": "cross-env NODE_ENV=production NODE_PATH=./ NODE_PATH=./modules/ nodemon --exec babel-node --presets es2015 server.js" }, "dependencies": { "cross-env": "^5.0.5"

new field false in Package.json

可紊 提交于 2019-12-06 23:33:28
问题 After upgrading to npm 5.* I have noticed a new field on the package.json which is really obscure and unintelligible. What false: {} means? { "name": "test", "devDependencies": {}, "dependencies": {}, // What that means? What's the goal? "false": {} } 回答1: This was bug #17141 in npm. It was fixed in commit c3b586a on June 30th and that was released in version 5.1.0 on July 5th. The fix for anyone experiencing this is to simply update npm. You can update by running: npm install -g npm 来源:

What is `“dev” true` in package-lock.json for?

眉间皱痕 提交于 2019-12-06 18:33:21
问题 What does "dev" true means in package-lock.json file? In my case it is automatically updated when I perform npm operations. How can we remove it? 回答1: From the npm docs at https://docs.npmjs.com/files/package-lock.json If true then this dependency is either a development dependency ONLY of the top level module or a transitive dependency of one. This is false for dependencies that are both a development dependency of the top level and a transitive dependency of a non-development dependency of

Fix all node modules' version numbers to the currently using ones in package.json

自作多情 提交于 2019-12-06 04:28:22
Currently, all node modules in package.json are using * as the version number, my application is quite stable with those node modules, so I want to fix their version numbers in package.json, so that I can run npm install in other places to install node modules with expected versions. Is there a way to do it quickly instead of changing them one by one manually? Such as some console commands, npm fixversion module_a module_b ... ? You're looking for npm shrinkwrap See the documentation here for more information. It will generate an npm-shrinkwrap.json with the current versions, and it takes

React Native v0.56: Cannot read property 'filename' of undefined at PluginPass.JSXOpeningElement

痞子三分冷 提交于 2019-12-05 20:37:30
问题 I just updated the React Native from 0.55 to 0.56. However, when I tried to run the code (react-native run-android OR run-ios), bundling stops to this point: Loading dependency graph, done. error: bundling failed: TypeError: Cannot read property 'filename' of undefined at PluginPass.JSXOpeningElement ({path_to_my_project}/react-native/node_modules/babel-plugin-transform-react-jsx-source/lib/index.js:32:39) This is my .babelrc: { "presets": [ "react-native" ], "env": { "development": {

npm package.json main and project structure

£可爱£侵袭症+ 提交于 2019-12-05 19:15:12
问题 I have a issue with npm and the main field. I see the documentation and as of my understanding I point main to be a different entry point than ./index.js. I already tested the package where all dist files are inside the root folder. I ignore src and test during pack phase using .npmignore but I did not like the point that building and packing the project to verify the structure pul all my files into the package root folder. So i changed the output to be dist instead. If i use npm pack and

Define private registry in package.json

有些话、适合烂在心里 提交于 2019-12-05 18:30:21
问题 We have a private npm repository based on Sinopia What should I define in package.json that some packages will be installed from Synopia rather then from global npm repository? If I install it from command line I can run: npm install <package_name> --registry <http://<server:port> P.S. tried to google and looked in official NPM documentation but have found nothing. 回答1: One of the method i know that is by .npmrc You can also use .npmrc also inside the project set configuration like this

Importing from shared folder from react native

我的未来我决定 提交于 2019-12-05 18:04:16
I'm in the process of creating a monorepo to hold both my React web app and my React Native app as they share a lot of common code. The setup i'm trying to get is: Project | +-- web +-- native ----|------ file.js (should be able to import from 'shared/file2.js') +-- shared ----|------ file2.js ----|------ package.json (with name="shared") +-- package.json From folowing this post: https://blog.callstack.io/a-cure-for-relative-requires-in-react-native-2b263cecf0f6#.4g1o5inru I added a package.json file to the shared folder with: { "name": "shared" } and am starting my native app from the package

how to Add my node_module, modules into package.json

扶醉桌前 提交于 2019-12-05 12:45:49
问题 I have some module in my node_module folder but because I am amateur in nodejs , when I wanted to install theme, I forgot to use --save with npm install .now I have lots of module but my package.json is empty so is there any way to add theme into package.json . Sorry if my question is silly one I am beginner in nodejs 回答1: Simply change into the directory containing node_modules , backup any existing package.json in there, then use npm init to re-create the package.json . The generated

Create package.json from package-lock.json

自闭症网瘾萝莉.ら 提交于 2019-12-05 12:20:27
问题 I downloaded a theme and it has a package-lock.json file but no package.json file. Is there a way I can generate the package.json from the package-lock.json file. How do I install the node modules with just the package-lock.json file. Is there a way to do that? 回答1: Install the latest npm with npm install -g npm Run npm init and respond to the questions. The above command will generate a package.json and include the existing packages listed in package-lock.json 回答2: package-lock.json file