Comments (16)
cc @amasad
from react-native.
I'm running into the same issue here. Here are my local node and npm versions just for reference:
→ npm -v
2.1.7
→ node -v
v0.10.33
from react-native.
That failure is at a line where it's trying to JSON.parse a package.json file. I'm looking into this now but do you have any custom node module that may have a malformed package.json?
from react-native.
Hey @jimjeffers @ColinEberhardt can you add a console.log(content)
before this line https://github.com/facebook/react-native/blob/master/packager/react-packager/src/DependencyResolver/haste/DependencyGraph/index.js#L270
That way we know what is failing to parse.
from react-native.
Thanks @amasad - this is the strange thing, when I add a console.log ...
.then(function(content) {
console.log(content);
var packageJson = JSON.parse(content);
I observe the following:
--- snip lots of package.json output above ---
{
"main" : "./lib"
}
SyntaxError: Unexpected end of input
at Object.parse (native)
at /Users/colineberhardt/Projects/react-native/packager/react-packager/src/DependencyResolver/haste/DependencyGraph/index.js:271:32
at _fulfilled (/Users/colineberhardt/Projects/react-native/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/Users/colineberhardt/Projects/react-native/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/Users/colineberhardt/Projects/react-native/node_modules/q/q.js:749:13)
at /Users/colineberhardt/Projects/react-native/node_modules/q/q.js:557:44
at flush (/Users/colineberhardt/Projects/react-native/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:442:13)
[20:29:18] <START> find dependencies
i.e. it outputs lots of package.json output, all of which looks fine. Then it hits the error but I don't see content
in the console log.
I've added logging to try and determine which file is causing issues:
if (packagePath != null) {
console.log('opening package: ' + packagePath);
return readFile(packagePath, 'utf8')
.then(function(content) {
console.log('opened package: ' + packagePath);
var packageJson = JSON.parse(content);
On npm start
I see a whole lot of logging, ending as follows:
opening package: /Users/colineberhardt/Projects/react-native/node_modules/react-tools/node_modules/commoner/node_modules/recast/node_modules/source-map/node_modules/amdefine/package.json
opened package: /Users/colineberhardt/Projects/react-native/node_modules/react-tools/node_modules/commoner/node_modules/recast/node_modules/source-map/node_modules/amdefine/package.json
opening package: /Users/colineberhardt/Projects/react-native/node_modules/module-deps/node_modules/browser-resolve/node_modules/resolve/test/resolver/biz/node_modules/garply/package.json
opened package: /Users/colineberhardt/Projects/react-native/node_modules/module-deps/node_modules/browser-resolve/node_modules/resolve/test/resolver/biz/node_modules/garply/package.json
Then as soon as I hit the URL in the browser, the following error is logged:
SyntaxError: Unexpected end of input
at Object.parse (native)
at /Users/colineberhardt/Projects/react-native/packager/react-packager/src/DependencyResolver/haste/DependencyGraph/index.js:272:32
at _fulfilled (/Users/colineberhardt/Projects/react-native/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/Users/colineberhardt/Projects/react-native/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/Users/colineberhardt/Projects/react-native/node_modules/q/q.js:749:13)
at /Users/colineberhardt/Projects/react-native/node_modules/q/q.js:557:44
at flush (/Users/colineberhardt/Projects/react-native/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:442:13)
[20:34:18] <START> find dependencies
I'm a bit baffled as i would have expected some logging before the error to indicate which package.json it was opening.
Confused!
from react-native.
@amasad would be nice to add a proper error message if a package.json file is malformed
from react-native.
It seems like it's choking on some test package.json files. I think we should ignore malformed package.json and just warn when building the dependency graph. Once the user require that module will figure out that something is wrong.
from react-native.
@ColinEberhardt will land a fix soon but try this for now:
- var packageJson = JSON.parse(content);
- if (packageJson.name == null) {
+ var packageJson;
+ try {
+ packageJson = JSON.parse(content);
+ } catch (e) {
+ debug('WARNING: malformed package.json: ', packagePath);
+ return q();
+ }
from react-native.
Thanks @amasad - here's the culprit:
WARNING: malformed package.json: /Users/colineberhardt/Projects/react-native/node_modules/npm/test/fixtures/config/package.json
from react-native.
Interesting, why do you have npm in mode_modules? Do we require it as a
dependency?
Regardless, will land the fix to ignore these malformed packages.
On Saturday, February 7, 2015, Colin Eberhardt [email protected]
wrote:
Thanks @amasad https://github.com/amasad - here's the culprit:
WARNING: malformed package.json: /Users/colineberhardt/Projects/react-native/node_modules/npm/test/fixtures/config/package.json
—
Reply to this email directly or view it on GitHub
#47 (comment)
.
from react-native.
Ahhhh!!! Found the issue - I mistakenly cut and paste the instructions from the README:
npm install npm start
Note, the lack of line-break, which causes an npm install npm
. Must have just been running on auto-pilot!
from react-native.
Haha no worries at all. Thanks for exposing this bug
On Saturday, February 7, 2015, Colin Eberhardt [email protected]
wrote:
Ahhhh!!! Found the issue - I mistakenly cut and paste the instructions
from the README:npm install npm start
Note, the lack of line-break, which causes an npm install npm. Must have
just been running on auto-pilot!—
Reply to this email directly or view it on GitHub
#47 (comment)
.
from react-native.
We fixed both the README and the error message. Thanks for this!
from react-native.
I have this error message without a path, did something get reverted?
Problem checking node_modules dependencies: Unexpected end of JSON input
from react-native.
I have @Haroenv's same issue.
from react-native.
I did a complete fresh install from the guide: https://facebook.github.io/react-native/docs/getting-started.html and I'm still running into this issue. The error message is quite cryptic. I'd hope for more detail in development mode. "07:53:10: Problem checking node_modules dependencies: Unexpected end of JSON input"
from react-native.
Related Issues (20)
- [0.74] New app hangs on blank screen if dev server is not started HOT 3
- `selectOnFocus` does not work with `autoFocus` HOT 2
- Android Native Module: Unresolved reference: PackageList HOT 2
- [0.73.6] HOT 2
- 【iOS】The contentOffset property is missing from TextInputView's onScroll callback HOT 4
- Animated.Event not working attached to onLayout with useNativeDriver enabled HOT 2
- [iOS][Information] App store submissions will require a privacy manifest and signature for hermes HOT 3
- Cookies not being sent to webview for iOS after React Native Upgrade HOT 4
- [0.74] Cannot access Dev Menu on Android (RNTester) HOT 4
- TextInput contextMenuHidden does not hide autofill HOT 1
- Showing Recent Messages Command PhaseScriptExecution failed with a nonzero exit code HOT 3
- Unknown unicode characters in Image source broken on iOS in New Architecture HOT 1
- TouchableWithoutFeedback crashes when SVG component is a direct child of it HOT 2
- FBReactNativeSpec build commands failed with RN 0.71.4 / Xcode 15.3 / M2 HOT 6
- error `fsevents` unavailable (this watcher can only be used on Darwin) HOT 2
- `@synthesize bridge = _bridge` not working with bridgeless mode and TurboModule
- No bundle url is present when run ios app on real iphone device HOT 3
- The application is slow after running for a long time without being used HOT 3
- Could not determine the dependencies of null. > Could not resolve all task dependencies for configuration ':classpath'. > Could not find com.facebook.react:react-native-vector-icons:10.0.3. HOT 5
- Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native.