Barefoot Web Design

Node NPM fails with “Cannot find module ‘../scripts/start'” after copying a project

Copying your Node.js project from one place to an other seems like a pretty easy task – as long as you use cp -a to do the copying (under Linux / macOS) you should be fine with the symbolic links. But what happens when said symlinks are left untouched? The next time you try to fire up Expo using npm start you will be greeted by the ever-so-friendly error:

Cannot find module '../scripts/start'

To resolve this, you need to open up a Terminal and visit the directory of your project:

  1. cd ~/projects/my_project
  2. npm install -g npm@latest
  3. rm -rf node_modules
  4. npm install

These commands reset and reinstall your modules as per your project configuration.