0
votes

I have moved the node_modules folder to the parent folder of the project to be able to share it between projects. Then when I execute "npm run dev" command inside the project folder I get this error:

E:\NodeApps\MyApp>npm run dev

> [email protected] dev E:\NodeApps\MyApp
> cross-env NODE_ENV=development webpack-dev-server --open --hot

'cross-env' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\me\AppData\Roaming\npm-cache\_logs\2019-05-27T23_51_07_151Z-debug.log

The solution was working fine before I moved the node_modules. I have read that the runtime will search up the directory-tree to find node_modules.

What are the steps to make the project work without moving node_modules back again?

1
Each project should have it's own package.json, and therefore, it's own node_modules folder.wmehanna
check the module.paths values.gp.
able to solved it or not??Avinash Singh
Avi, I had to move the folder back for now because I didn't have time to wait. But I will try again later today and then I can tell.MaxP

1 Answers

1
votes

Every project has it's own package.json which have their own dependencies and devdependencies which is required to the particular project and copying node_modules doesn't change the path or modify related things.Also Set the path in ENVIRONMENT VARIABLES(already done then leave that).

Run this command:

npm install