just-boris / create-preact-app

Create Preact apps with no build configuration.
MIT License
95 stars 8 forks source link

Error: Cannot find module node_modules/package.json #29

Closed jim80 closed 6 years ago

jim80 commented 6 years ago

Is this a bug report?

Yup!

Strangely, I encounter a persistent error on running create-react-app my-app --scripts-version @just-boris/preact-scripts

I have a feeling it's most likely due to slightly older node/npm or create-react-app, version numbers are printed at the bottom of my terminal contents below.

create-react-app works just fine by the way!

No problem for me just now, I'm just tinkering, but thought I should let you know.

Regards, Jim.

jims-MacBook-Pro-3:temp jim$ mkdir testboris jims-MacBook-Pro-3:temp jim$ cd testboris/ jims-MacBook-Pro-3:testboris jim$ create-react-app my-app --scripts-version @just-boris/preact-scripts Creating a new React app in /Users/jim/work/temp/testboris/my-app.

Installing packages. This might take a couple minutes. Installing react-scripts from npm...

fsevents@1.1.2 install /Users/jim/work/temp/testboris/my-app/node_modules/fsevents node install

[fsevents] Success: "/Users/jim/work/temp/testboris/my-app/node_modules/fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node" already installed Pass --update-binary to reinstall or --build-from-source to recompile

uglifyjs-webpack-plugin@0.4.6 postinstall /Users/jim/work/temp/testboris/my-app/node_modules/uglifyjs-webpack-plugin node lib/post_install.js

my-app@0.1.0 /Users/jim/work/temp/testboris/my-app └─┬ @just-boris/preact-scripts@1.0.17 ├─┬ autoprefixer@7.1.6

(ETC ETC.... looks nice all the packages get installed

module.js:457 throw err; ^

Error: Cannot find module '/Users/jim/work/temp/testboris/my-app/node_modules/package.json' at Function.Module._resolveFilename (module.js:455:15) at Function.Module._load (module.js:403:25) at Module.require (module.js:483:17) at require (internal/module.js:20:19) at checkNodeVersion (/Users/jim/.nvm/versions/node/v6.7.0/lib/node_modules/create-react-app/index.js:170:21) at ChildProcess. (/Users/jim/.nvm/versions/node/v6.7.0/lib/node_modules/create-react-app/index.js:127:5) at emitTwo (events.js:106:13) at ChildProcess.emit (events.js:191:7) at maybeClose (internal/child_process.js:877:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) jims-MacBook-Pro-3:testboris jim$ ls my-app jims-MacBook-Pro-3:testboris jim$ ls my-app/node_modules/package.json ls: my-app/node_modules/package.json: No such file or directory jims-MacBook-Pro-3:testboris jim$ npm -v 3.10.3 jims-MacBook-Pro-3:testboris jim$ node -v v6.7.0 jims-MacBook-Pro-3:testboris jim$ npm ls react-scripts /Users/jim └── (empty)

npm ERR! code 1 jims-MacBook-Pro-3:testboris jim$ create-react-app --help Usage: create-react-app [--verbose] jims-MacBook-Pro-3:testboris jim$ create-react-app --version create-react-app version: 0.5.0 jims-MacBook-Pro-3:testboris jim$

jim80 commented 6 years ago

OK, seems my ancient install of create-react-scripts caused this (though it's never failed me!), updated it and everything is now fine. I also have a shiny new create-react-scripts that uses yarn and everything! ;) Apologies for the noise, I guess if in the unlikely event anyone else hits this one then they'll google here and know what one cause may be. Regards, Jim.