Run next.js app with npm start, NOT next start (i.e. without next installed)? - npm

Is it possible to run a next.js app without having next installed on the target system? I made a basic next app on my dev computer that has next installed, but the system I want to run it on only has node/npm, not next. When I try to start the app with "npm start" or "npm run dev" it just triggers the start script in package.json that calls next start, giving me 'next' is not recognized as an internal or external command, operable program or batch file.
I tried modifying package.json so instead of start => next start, it would call npm start, but it gave me an error about missing dependencies. Maybe I need to tweak this more, or maybe there is some way of building a next app with npm-pack-all that does not require next?

Related

How to run Vue.js app locally & run Cypress tests against it sequentially using npm script

I am trying to run a Vue.js app locally (localhost:3000) & then run Cypress tests against it.
Below are some npm scripts in my package.json:
"dev": "nuxt",
"cypress": "npx cypress open",
"localCypress": "npm run dev && npm run cypress"
When I run the above dev & cypress commands on their own, they work as expected.
But when I try to run them both sequentially using localCypress, only the app is starting, & the Cypress Explorer isn't opening (npm run cypress part doesn't seem to be working).
Can someone please point out why this is occurring & how I can resolve it?
The problem is that the npm run dev spins a server and that's a long running process, that won't close until you manually stop it (or if it crashes). In both cases, it will return an exit code different than 0, so the second command after && won't run.
Take a look to this question to see how to run two npm process in parallel:
How can I run multiple npm scripts in parallel?

npm init results in package manager console stuck with "Press ^C at any time to quit."

When I try to type "npm init" in the package console manager it starts the process, but the console is stuck with the message: "Press ^C at any time to quit.". I can create my package.json file, and I am therefore completely stuck. When running the whole program I get the error: "The command "npm run build" exited with code 1.".
Error when running "npm init":
I know a lot of people had success with removing the package_lock.json filer and node_modules folder, but this solves nothing for me. Stuck for 10 hours now - can anyone help?

Task :app:processDebugResources FAILED - REACT-NATIVE - ANDROID-STUDIO

im trying to run the app in my real device using android studio, eveything is ready and correct, but when i run react-native run-android it will first says connect to the server but then this error appears:
want to use the device as debugger
For running expo apps, you would normally do this using the command line.
Navigate to the root of your project, then (if you still have all the defaults set) you should be able to open a terminal in that directory and type npm run start. This will start the metro bundler and the other react native tools.
The first time doing this might take a while, but when it's done, you should see a QR code. Scan it with your device, you should be prompted to download the expo app and then your application will run on your phone. You only need to download the expo app once, and all the apps you develop using expo will run on it.
I'm not totally sure if this answers your question, but I hope this helped.
*note that this assumes that you have and use npm, the process is slightly different for yarn and other package managers. If npm run start doesn't work for you, make sure you have npm in the PATH variable, and check the package.json file. You should see an entry in scripts - "start": "expo start". You need to type npm run then whatever your key is for the script that has a value of "expo start"

Having to create a .nuxt folder every time I compile my app

Every time I run npm run dev(that's how my team set up that project) I get this error:
ERROR EEXIST: file already exists, mkdir 'X:......\my-project\.nuxt'
I then need to do mkdir .nuxt and try again. Usually it works, sometimes it doesn't: it keeps asking me that everytime I run npm run dev and after 5 or 10 times it works. Sometimes I won't work no matter how many times I try, so I restart my machine and then it works.
Any idea what's going on?
I have had issues of this kind when running in the past with gulp in parallel tasks that would delete and write to the same deleted directory. But, without having more information about this, and just knowing that sometimes the .nuxt directory is missing. I can't really get to the root of the problem. It might be something related with the nuxt.config.js
This is the only solution that I see for now.
Even though this might not fix the original issue what you could do to at least be able to develop without having to worry any longer is:
Add the rimraf package and run it always before running the dev command.
Add the mkdirp package and run it after the deletion of the folder happen
If you add the commands globally now you should have in your terminal both commands available and you can run
rimraf ./.nuxt && mkdirp .nuxt && npm run dev
This would be the least intrusive approach as it wouldn't affect any of your team members.
If also they are affected by this you can also add this packages as a devDependency and add another npm run dev command as shown here.
{
...
"scripts": {
"dev": "rimraf ./.nuxt && mkdirp .nuxt && npm run dev"
}
...
}

IntelliJ stuck after running npm scripts

I have created a Scala, Play project. I am trying to add Angular2 in it. I added two npm commands through edit configuration. They are suppose to install the required packages and use webpack to bundle final JS. I notice that nothing happens after 2nd script is executed (I do not know if that script is hung or there is some other issue (see pic). It seems that the 2nd npm script is stuck because on stopping the run command, I see exit code 1 - Process finished with exit code 1
Is there a way to find out if Intelli build/run process is still running?
The issue was with the 2nd script (npm start). I had to remove --profile --watch flag from the webpack command. This works - "scripts": {
"start": "webpack --config webpack.config.dev.js --progress"
}