Skip to content

npm start fails after copying a generated project to a new directory  #200

Closed
@dceddia

Description

@dceddia

Here is the failure:

$ npm start

> [email protected] start /Users/dceddia/Projects/pure-react/sandbox/bug-test-copy
> react-scripts start

module.js:339
    throw err;
    ^

Error: Cannot find module 'cross-spawn'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/Users/dceddia/Projects/pure-react/sandbox/bug-test-copy/node_modules/.bin/react-scripts:3:13)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:457:10)

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/Cellar/node/5.0.0/bin/node" "/Users/dceddia/.node/bin/npm" "start"
npm ERR! node v5.0.0
npm ERR! npm  v3.3.12
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `react-scripts start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script 'react-scripts start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the bug-test package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     react-scripts start
npm ERR! You can get their info via:
npm ERR!     npm owner ls bug-test
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/dceddia/Projects/pure-react/sandbox/bug-test-copy/npm-debug.log

To reproduce:

$ create-react-app bug-test
$ cp -r bug-test bug-test-copy
$ cd bug-test-copy
$ npm start

At first I thought it might have something to do with having run npm start from within bug-test before copying it, but skipping that step didn't have any effect.

Removing node_modules and reinstalling them fixes it:

$ cd bug-test-copy
$ rm -r node_modules
$ npm install
$ npm start   # works!

Using cp -a instead of cp -r does not cause the problem:

$ create-react-app bug-test
$ cp -a bug-test bug-test-copy
$ cd bug-test-copy
$ npm start   # works!

I'm running Node 5.0.0 and npm 3.3.12.

I tried (via nvm) with Node 6.3.1 and npm 3.10.3 and got the same behavior.

The cp -a vs cp -r makes me think this might be an npm bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions