Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strapi alpha.6 cannot create new project. strapi-generate-admin missing #315

Closed
rewop opened this issue Oct 31, 2017 · 12 comments
Closed

Strapi alpha.6 cannot create new project. strapi-generate-admin missing #315

rewop opened this issue Oct 31, 2017 · 12 comments
Assignees
Labels
issue: bug Issue reporting a bug

Comments

@rewop
Copy link

rewop commented Oct 31, 2017

I installed strapi with yarn in my local repo.

When running:

yarn strapi new my-project

I get the following error:

 Error: Error: Failed to load `admin`... (Error: Cannot find module '/Users/rewop/cms-test/node_modules/strapi/node_modules/strapi-generate-admin')
        at parseTarget (/Users/rewop/cms-test/node_modules/strapi-generate/lib/target.js:248:15)
        at async.until.asyncCb (/Users/rewop/cms-test/node_modules/strapi-generate/lib/target.js:45:7)
        at whilst (/Users/rewop/cms-test/node_modules/async/dist/async.js:5200:5)
        at Object.until (/Users/rewop/cms-test/node_modules/async/dist/async.js:5226:5)
        at generateTarget (/Users/rewop/cms-test/node_modules/strapi-generate/lib/target.js:40:9)
        at async.eachSeries (/Users/rewop/cms-test/node_modules/strapi-generate/lib/generate.js:116:13)
        at /Users/rewop/cms-test/node_modules/async/dist/async.js:3083:16
        at replenish (/Users/rewop/cms-test/node_modules/async/dist/async.js:946:17)
        at /Users/rewop/cms-test/node_modules/async/dist/async.js:950:9
        at eachLimit$1 (/Users/rewop/cms-test/node_modules/async/dist/async.js:3169:24)

It looks like the package strapi-generate-admin is not installed correctly

Node.js version:
8.7.0 **yarn version**: v1.2.1**Strapi version**:3.0.0-alpha.6.4`
Operating system:
Mac OSx

@soupette
Copy link
Contributor

Could you try to install Strapi with npm (version 5.3.0) and run strapi new my-project instead?

@rewop
Copy link
Author

rewop commented Oct 31, 2017

With npm (5.4.2 in my case) I have the same error. To note I am installing strapi locally and not globally. So with npm I run

./node_modules/.bin/strapi new my-project

and the error is the same. This is because strapi-generate-admin is installed in node_modules folder, and not node_modules/strapi/node_modules.

Instead if I install globally with npm it works correctly, but I have the same error if I install globally with yarn,

So the problem is when I install the strapi utility locally with npm, or when I install it with yarn.

@rewop
Copy link
Author

rewop commented Oct 31, 2017

Quickly looking at the code I wonder why a module declared in package.json is loaded with relative path?

if (!subGenerator) {
try {
subGenerator = require(path.resolve(process.cwd(), 'node_modules', module));
} catch (e1) {
requireError = e1;
}
}
// If we couldn't find a generator using the configured module,
// try requiring `strapi-generate-<module>` to get the core generator.
if (!subGenerator && !module.match(/^strapi-generate-/)) {
try {
subGenerator = require(path.resolve(scope.strapiRoot, 'node_modules', 'strapi-generate-' + module));
} catch (e1) {
requireError = e1;
}
}

I think the problem is related to those lines.

@ghost
Copy link

ghost commented Apr 23, 2018

I'm still experiencing this bug. Shall I open a new one?

[nix-shell:~/backend]$ npm install strapi@alpha
npm WARN deprecated sprintf@0.1.5: The sprintf package is deprecated in favor of sprintf-js.
npm WARN saveError ENOENT: no such file or directory, open '/home/user/backend/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/user/backend/package.json'
npm WARN backend No description
npm WARN backend No repository field.
npm WARN backend No README data
npm WARN backend No license field.

+ strapi@3.0.0-alpha.12.0.1
added 339 packages in 17.476s

[nix-shell:~/backend]$ ./node_modules/.bin/strapi new backend
[2018-04-23T22:24:23.785Z] info Creating your application... It might take a few seconds.
[2018-04-23T22:24:23.934Z] info Lets configurate the connection to your database:
 Choose your main database: MongoDB (highly recommended)
 Database name: strapi
 Host: 127.0.0.1
 Port: 27017
 Username:
 Password:
 Authentication database:
 Enable SSL connection: false
[2018-04-23T22:24:34.231Z] info Testing database connection...
[2018-04-23T22:24:35.097Z] info The app has been connected to the database successfully!
[2018-04-23T22:24:35.208Z] info Copying the dashboard...
[2018-04-23T22:24:35.226Z] error Error: Failed to load `admin`... (Error: Cannot find module '/home/user/backend/node_modules/strapi/node_modules/strapi-generate-admin')

[nix-shell:~/backend]$ node --version; npm --version
v9.11.1
5.6.0

[nix-shell:~/backend]$ yarn global list
yarn global v1.5.1
info "vue-cli@2.9.3" has binaries:
   - vue
   - vue-init
   - vue-list
Done in 0.88s.

Does anyone have an idea what's going on there? Could we re-open this issue, @Aurelsicoko? Or should I open a new one?

@ghost
Copy link

ghost commented Apr 23, 2018

The PR #317 is included in strapi@3.0.0-alpha.12.0.1, right?

@leolara
Copy link

leolara commented Sep 30, 2018

I have the same issue today. My yarn installation said I got 3.0.0-alpha.14.2

@lauriejim
Copy link
Contributor

Try with npm please.

@wision
Copy link

wision commented Oct 26, 2018

Still same issue with 3.0.0-alpha.14.4.0 and npm. (the problem was that I didn't install it globally, which sucks tbh)

@Aurelsicoko
Copy link
Member

You're right, we should also support local installation. However, I would suggest making a PR to support local installation because it's not one of our priorities for now.

@lauriejim
Copy link
Contributor

In this case (for non global installation), you can use npx

@schabluk
Copy link

Having the same problem with 3.0.0-alpha.19.

@lauriejim
Copy link
Contributor

If you are using Yarn, it's not supported by Strapi so switch to npm.
More information here https://github.com/strapi/strapi/wiki/Frequently-Asked-Questions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Issue reporting a bug
Projects
None yet
Development

No branches or pull requests

7 participants