1

I have the problem that I can only run my npm scripts f.e. npm run dev or npm run build when my folder sits on the Desktop. As soon as I try to put the folder into my folder structure, it throws the following error:

npm run dev

> react-course@1.0.0 dev C:\Users\dhaas\Documents\Web development\JS & react projekte\petfinder
> parcel src/index.html

Der Befehl "react" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
internal/modules/cjs/loader.js:796
    throw err;
    ^

Error: Cannot find module 'C:\Users\dhaas\Documents\Web development\parcel-bundler\bin\cli.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
    at Function.Module._load (internal/modules/cjs/loader.js:686:27)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at internal/main/run_main_module.js:17:11 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-course@1.0.0 dev: `parcel src/index.html`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-course@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\dhaas\AppData\Roaming\npm-cache\_logs\2020-04-07T09_06_17_441Z-debug.log

This problem occurs with parcel and webpack. Installing npm globally and reinstalling the packags locally wasn't the solution.

Thank you for you help!

David Haase
  • 179
  • 1
  • 8

2 Answers2

0

Are u using windows? If yes, then pls replace Web development with Web_development.

or

Is node_modules package is created at desktop? If yes, then pls install package globally.

If both cases are not meet then pls share package.json script and ensure all dependency are install locally or globally.

Sarvesh_18
  • 21
  • 6
0

Here with a different approach which explains another question although since it is somewhat related here goes configure npm&webpack Win10 for long paths using relative paths.

Guess the solution currently is you have to copy the whole folder and if all is well configured you can npx webpack or npm run build from a simple path like C:\temporary\root_folder and when done replace the contents in C:\here\is\long\path\root_folder
Cheers.