bamlab / react-native-make

A collection of everyday React Native CLI tools
MIT License
762 stars 89 forks source link

Package @bam.tech/react-native-make has been ignored because it contains invalid configuration #11

Closed mcoeur closed 4 years ago

mcoeur commented 5 years ago

Hello,

Context : Platform : MacOS

$react-native -v
react-native-cli: 2.0.1
react-native: 0.60.4

I get this error when i run the following command :

react-native set-splash --path src/assets/logo.png --background "#f9f4f0" --resize center
warn Package @bam.tech/react-native-make has been ignored because it contains invalid configuration. Reason: Cannot find module '/Users/mcoeur/Documents/Dev/MyApp/node_modules/@react-native-community/cli/package.json'
Require stack:
- /Users/mcoeur/Documents/Dev/MyApp/node_modules/@bam.tech/react-native-make/dist/rn-plugin.config.js
- /Users/mcoeur/Documents/Dev/MyApp/node_modules/@bam.tech/react-native-make/react-native.config.js
- /Users/mcoeur/Documents/Dev/MyApp/node_modules/import-fresh/index.js- /Users/mcoeur/Documents/Dev/MyApp/node_modules/cosmiconfig/dist/loaders.js
- /Users/mcoeur/Documents/Dev/MyApp/node_modules/cosmiconfig/dist/createExplorer.js
- /Users/mcoeur/Documents/Dev/MyApp/node_modules/cosmiconfig/dist/index.js
- /Users/mcoeur/Documents/Dev/MyApp/node_modules/react-native/node_modules/@react-native-community/cli/build/tools/config/readConfigFromDisk.js
- /Users/mcoeur/Documents/Dev/MyApp/node_modules/react-native/node_modules/@react-native-community/cli/build/tools/config/index.js
- /Users/mcoeur/Documents/Dev/MyApp/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/install/install.js
- /Users/mcoeur/Documents/Dev/MyApp/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/index.js
- /Users/mcoeur/Documents/Dev/MyApp/node_modules/react-native/node_modules/@react-native-community/cli/build/cliEntry.js
- /Users/mcoeur/Documents/Dev/MyApp/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js
- /Users/mcoeur/Documents/Dev/MyApp/node_modules/react-native/cli.js
- /Users/mcoeur/.nvm/versions/node/v12.8.0/lib/node_modules/react-native-cli/index.js
error Unrecognized command "set-splash".
info Run "react-native --help" to see a list of all available commands.

I followed this blog post to install everything : https://blog.bam.tech/developper-news/set-up-your-react-native-splash-screen-in-15-minutes

What did I miss ?

yleflour commented 5 years ago

Linked to #6 , plugin is currently incompatible with npm (yarn only) a fix is being developed

huangtony commented 5 years ago

I'm still having this problem using 1.0.3 and react-native set-splash --path logo.png --resize center.

warn Package @bam.tech/react-native-make has been ignored because it contains invalid configuration. Reason: Unexpected token {

Installed using yarn add -D @bam.tech/react-native-make.

react-native-cli: 2.0.1
react-native: 0.61.1

At first I installed it on react-native 0.60.5, uninstalled it, upgraded to 0.61.1, reinstalled but still have the same issue. I don't see the commands in react-native -h either.

yleflour commented 5 years ago

Thanks for the feedback. I will try making this plugin available through command line under the rnmake alias

On Mon, Oct 7, 2019, 08:27 Tony notifications@github.com wrote:

I'm still having this problem using 1.0.3 and react-native set-splash --path logo.png --resize center.

warn Package @bam.tech/react-native-make has been ignored because it contains invalid configuration. Reason: Unexpected token {

Installed using yarn add -D @bam.tech/react-native-make.

react-native-cli: 2.0.1 react-native: 0.61.1

At first I installed it on react-native 0.60.5, uninstalled it, upgraded to 0.61.1, reinstalled but still have the same issue. I don't see the commands in react-native -h either.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/bamlab/react-native-make/issues/11?email_source=notifications&email_token=AAOG6JLIJCDHFVTLIY7UU6LQNLJDLA5CNFSM4IZ4PQT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAPE4EA#issuecomment-538856976, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOG6JNCZMLJDKBPPB7Z5HDQNLJDLANCNFSM4IZ4PQTQ .

logicallydimp23 commented 5 years ago

@huangtony try to use v1.02 yarn add -D @bam.tech/react-native-make@1.0.2 It worked with react-native version 0.61.2

huangtony commented 5 years ago

@logicallydimp23 Thanks, v1.02 worked fine.

yleflour commented 5 years ago

Hello, @mcoeur , can you tell me your react-native-cli package.json local install path within your project? It seems that I haven't handled all possibilities

tomeberle commented 5 years ago

Having this issue as well with RN 0.60.5 / npm install..

logicallydimp23 commented 5 years ago

Having this issue as well with RN 0.60.5 / npm install..

@tomeberle as a workaround have you tried v1.0.2? yarn add -D @bam.tech/react-native-make@1.0.2

tomeberle commented 5 years ago

@logicallydimp23 Yes, but I had issues as well as the project is using npm and not yarn. Specifically, the yarn install was failing on MS Appcenter.

yleflour commented 4 years ago

@logicallydimp23 Can you give me:

yleflour commented 4 years ago

By the way, I need all the help I can get solving this issue.

For your information, previous invalid configuration errors were because @react-native-community/cli/package.json couldn't be resolved.

Currently supported paths (cwd is your react-native project directory):

If your path doesn't match either of those, can you tell me:

logicallydimp23 commented 4 years ago

@yleflour

finnp commented 4 years ago

I went to the node_modules/@bam.tech/react-native-make/dist/rn-plugin.config.js file and removed the V1 detection script:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("colors");
const modules_1 = require("./modules");
const path_1 = require("path");
const rn_compatibility_layer_1 = require("./rn-compatibility-layer");
const v2Config = {
    commands: [modules_1.setIconCommand, modules_1.setSplashScreenCommand],
};
exports.rnPluginConfig = v2Config;

After that it was working correctly.

Maybe you can just deprecate v1?