api-platform / admin

A beautiful and fully-featured administration interface builder for hypermedia APIs
https://api-platform.com/docs/admin/
MIT License
480 stars 130 forks source link

When start is error #492

Closed bhtomming closed 1 year ago

bhtomming commented 1 year ago

API Platform version(s) affected: ^3.0

Description
I create a new project,

npm init react-app my-admin
cd my-admin
yarn install @api-platform/admin
yarn start 

in here is Ok. When I set the App.js

import { HydraAdmin } from "@api-platform/admin";

// Replace with your own API entrypoint
// For instance if https://example.com/api/books is the path to the collection of book resources, then the entrypoint is https://example.com/api
export default () => (
  <HydraAdmin entrypoint="https://demo.api-platform.com/docs" />
);
WARNING in ./node_modules/jsonref/dist/errors.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'D:\laragon\www\my-admin\node_modules\jsonref\dist\errors.js.map' file: Error: ENOENT: no such file or directory, open 'D:\laragon\www\my-admin\node_modules\jsonref\dist\errors.js.map'

WARNING in ./node_modules/jsonref/dist/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'D:\laragon\www\my-admin\node_modules\jsonref\dist\index.js.map' file: Error: ENOENT: no such file or directory, open 'D:\laragon\www\my-admin\node_modules\jsonref\dist\index.js.map'

WARNING in ./node_modules/jsonref/dist/meta.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'D:\laragon\www\my-admin\node_modules\jsonref\dist\meta.js.map' file: Error: ENOENT: no such file or directory, open 'D:\laragon\www\my-admin\node_modules\jsonref\dist\meta.js.map'

WARNING in ./node_modules/jsonref/dist/patch.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'D:\laragon\www\my-admin\node_modules\jsonref\dist\patch.js.map' file: Error: ENOENT: no such file or directory, open 'D:\laragon\www\my-admin\node_modules\jsonref\dist\patch.js.map'

WARNING in ./node_modules/jsonref/dist/pointer.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'D:\laragon\www\my-admin\node_modules\jsonref\dist\pointer.js.map' file: Error: ENOENT: no such file or directory, open 'D:\laragon\www\my-admin\node_modules\jsonref\dist\pointer.js.map'

is was error,when the entrypoint is my project API also get the same error. I don't know why I create a new project can get this error.

alanpoulain commented 1 year ago

There are not errors but warnings. The issue is from the jsonref package, see https://github.com/vivocha/jsonref/pull/3. I'm planning to switch to https://github.com/APIDevTools/json-schema-ref-parser soon.

bhtomming commented 1 year ago

Is warnings,but is can't run now, the web is blank.

bhtomming commented 1 year ago

There are not errors but warnings. The issue is from the jsonref package, see vivocha/jsonref#3. I'm planning to switch to https://github.com/APIDevTools/json-schema-ref-parser soon.

When I fix add the whole dist directory to files

"files": [
    "dist",
    "README.md",
    "LICENSE"
  ],

then run

yarn start 

I get the new error

Failed to compile.

Module not found: SyntaxError: D:\laragon\www\my-admin\node_modules\jsonref\package.json (directory description file): SyntaxError: D:\laragon\www\my-admin\node_modules\jsonref\package.json (directory description file): SyntaxError: Unexpected token / in JSON at position 308
ERROR in ./node_modules/@api-platform/api-doc-parser/lib/openapi3/handleJson.js 2:0-47
Module not found: SyntaxError: D:\laragon\www\my-admin\node_modules\jsonref\package.json (directory description file): SyntaxError: D:\laragon\www\my-admin\node_modules\jsonref\package.json (directory description file): SyntaxError: Unexpected token / in JSON at position 308

webpack compiled with 1 error