created my project with my app
This is the project.json file. That I have created
{
"name": "detox",
"version": "0.0.1",
"private": true,
"scripts": {
"ios": "react-native run-ios",
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"test:e2e":"navicotrackapp test",
"test:e2e:build":"navicotrackapp build"
},
"dependencies": {
"react": "16.6.1",
"react-native": "0.57.7"
},
"devDependencies": {
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.49.2",
"react-test-renderer": "16.6.1"
},
"jest": {
"preset": "react-native"
},
"detox": {
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/navicotrackapp.app",
"build": "xcodebuild -project ios/navicotrackapp.xcodeproj -scheme navicotrackapp -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone XR"
}
}
}
}
However. When I ran the test this was the out come:
Questions:
What did I do wrong
How do I fix it?
For those coming with yarn 127 error code problem
Take a look on https://github.com/reactstrap/reactstrap/issues/711
Most probably you just need to run in console yarn :)
Replace your scripts values with these, and try again:
"scripts": {
"ios": "react-native run-ios",
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"test:e2e":"npm run test",
"test:e2e:build":"npm run build" // THIS SCRIPT WILL STILL BREAK FOR YOU
},
The last two are the important ones!
You need to prefix a script command with npm run or yarn if the script references another script in your package.json.
So instead of a script calling navicotrackapp test it would call npm run test OR yarn test.
NOTE:
In you example it looks like the terminal is failing on the script navicotrackapp build. Know that you do not have a build script defined so if you replace the script with npm run build it will still fail. You'll need to add a build script in if you want it to work!
"scripts": {
"ios": "react-native run-ios",
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"build": // DO SOMETHING HERE!!!!,
"test:e2e":"npm run test",
"test:e2e:build":"npm run build"
},
Try below commands it works for me
$ npm install #ionic/app-scripts#latest --save-dev
$ ionic serve
Just use https://app.netlify.com/drop to deploy manually on Netlify
first run this command
npm run build
OR
yarn run build
Then drag and drop the build folder on the website above.
Try this, and please take care of the spaces.
It worked for me though. I added CI= in the capital before npm run build. Double-check if you did git add. , git commit -m "first commit" and git push -u origin before your final deployment.
Related
I have installed the react-clear-cache package and in the docs it says that I need to add a new script to my package.json.
This is my package.json scripts:
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"prebuild": "npm run generate-build-meta",
"generate-build-meta": "./node_modules/react-clear-cache/bin/cli.js"
},
According to the docs I need to run npm run generate-build-meta but everytime I try, node tells me that it wasnt able to find "./node_modules/react-clear-cache/bin/cli.js"
What I should do to correctly run this cli.js?
By the way, I have the react-clear-cache in my node_modules and I can see the cli.js
This is the message I receive:
It is pretty much saying that '.' is not recognized as an internal command.
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"prebuild": "npm run generate-build-meta",
"generate-build-meta": "react-clear-cache"
},
Accessing node_modules binaries by path is unnecessary in package.json scripts. Within the package.json, you can proceed as though node_modules/**/bin/ is in your $PATH.
Here is my package.json file and im trying to run command - 'npm run webpack'.
{
"name": "react-graphql2",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack",
"dev": "webpack-dev-server",
"dev-https": "webpack-dev-server --https",
"prettier": "prettier --write './{src,tests}/**/*.{ts,tsx,js,jsx,json,css,scss}'",
"start": "yarn run build",
"test": "jest --coverage",
"testDev": "jest"
When I run this command I get the below output and the package is built without issues-
laks2#1976190:~/projects/spa-test/react-graphql2$ npm run build
> react-graphql2#1.0.0 build /Users/laks/projects/spa-test/react-graphql2
> webpack
webpack.config.js
clean-webpack-plugin: /Users/laks/projects/spa-test/react-graphql2/dist/js/*.js has been removed.
Now, I move the same project to a different folder and run the same command, now I dont see the webpack.config.js being passed -
laks2#1976190:~/projects/spa-test/react-graphql2$ npm run build
> react-graphql2#1.0.0 build /Users/laks/projects/spa-test/react-graphql2
> webpack
clean-webpack-plugin: /Users/laks/projects/spa-test/react-graphql2/dist/js/*.js has been removed.
I have downloaded following React Material template
template
Followed steps from documentation
package.json
{
"name": "material-dashboard-react",
"version": "1.6.0",
"description": "Material Dashboard React. Coded by Creative Tim",
"private": false,
"main": "dist/index.js",
"scripts": {
"start": "NODE_PATH=./src react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm start",
"lint:check": "eslint . --ext=js,jsx; exit 0",
"lint:fix": "eslint . --ext=js,jsx --fix; exit 0",
"build-package-css": "cp src/assets/css/material-dashboard-react.css dist/material-dashboard-react.css",
"build-package": "npm run build-package-css && babel src --out-dir dist"
},
}
Getting the following error
It is because you are using Windows. The project was likely ran on unix based computers before (NODE_PATH=./src is not a windows way of defining environment variables). You can either fix it by using the Windows syntax "start": "set NODE_PATH=./src react-scripts start", (your project will not run on unix machines) or use a cross-env library for defining your environment : https://www.npmjs.com/package/dotenv
For anyone wondering, I had the same issue with the same template and my solution was to configure a file in the project root as specified in this link.
I'm using docker and my working directory is in the /app directory, so I added this line in my tsconfig.json file at the root of my react app folder:
"compilerOptions": {
...,
"baseUrl": "/app/src",
}
Any advise on how to achieve live-reloading when implementing a Chrome Extension with create-react-app? Currently I yarn run build every time there is a change.
I managed to do that using create-react-app by:
npm i npm-watch --save-dev
Then in the package.json
{
"name": "react-app",
"version": "0.1.0",
"private": false,
"devDependencies": {
"npm-watch": "^0.1.8",
"react-scripts": "0.9.5",
},
"dependencies": {
"react": "^15.4.2",
"react-dom": "^15.4.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"watch": "npm-watch" //add this to the script
},
"watch": { //add this outside the script
"build": "src/"
}
}
I got this working with fswatch on Mac (had to brew install fswatch):
fswatch -o ~/$PATH_TO_YOUR_PROJECT/src | xargs -n1 -I{} npm run build
This will run npm run build anytime the src directory changes (which is what I was doing manually beforehand anyways)
Note: my manifest is pointing to the build directory for my popup.
I achieve live-reloading when implementing a Chrome Extension V3 with create-react-app. Whatever you change page or content script, all things is auto refresh/reload.
https://github.com/Godiswill/cra-crx-boilerplate
I'm just trying to do the first angular.js tutorial on the official website. When I try to run npm install from my project directory I get the following error.
My package.json file is given below.
{
"version": "0.0.0",
"private": true,
"name": "angular-phonecat",
"description": "A tutorial application for AngularJS",
"repository": "https://github.com/angular/angular-phonecat",
"license": "MIT",
"devDependencies": {
"karma": "^0.12.16",
"karma-chrome-launcher": "^0.1.4",
"karma-jasmine": "^0.1.5",
"protractor": "~1.0.0",
"http-server": "^0.6.1",
"tmp": "0.0.23",
"bower": "^1.3.1",
"shelljs": "^0.2.6"
},
"scripts": {
"postinstall": "bower install",
"prestart": "npm install",
"start": "http-server -a 0.0.0.0 -p 8000",
"pretest": "npm install",
"test": "node node_modules/karma/bin/karma start test/karma.conf.js",
"test-single-run": "node node_modules/karma/bin/karma start test/karma.conf.js --single-run",
"preupdate-webdriver": "npm install",
"update-webdriver": "webdriver-manager update",
"preprotractor": "npm run update-webdriver",
"protractor": "protractor test/protractor-conf.js",
"update-index-async": "node -e \"require('shelljs/global'); sed('-i', /\\/\\/##NG_LOADER_START##[\\s\\S]*\\/\\/##NG_LOADER_END##/, '//##NG_LOADER_START##\\n' + cat('bower_components/angular-loader/angular-loader.min.js') + '\\n//##NG_LOADER_END##', 'app/index-async.html');\""
}
}
Can someone help me to solve this problem. Thanks.
The messages are warnings, sometimes that just happens, and they often are uneeded anyway.
As long as the main components, Bower, Protractor, Karma etc are working, then I would try just carry on with the tutorial.
You can test they are working by running their commands, e.g.
./node_modules/.bin/bower help
But
I think one issue I had with npm and running those commands is that they dont just run like the angular tutorial says.
So where the tutorial says, run this:
protractor test/protractor-conf.js
You might have to modify the command to this
./node_modules/.bin/protractor test/protractor-conf.js
Same with bower, karma etc
e.g.
put this in front of the commands
./node_modules./bin
the ./ says run this as a script and the path is so you access the scripts in the node_modules/.bin directories
Update
If you want to run a karma test:
First, make sure you are in the root directory of the project
./node_modules/.bin/karma start test/karma.conf.js --single-run