book icon indicating copy to clipboard operation
book copied to clipboard

Running `wasm-pack build` doesn't create package.json in `pkg` directory

Open ev-rvs opened this issue 4 years ago • 2 comments

Describe the bug Stepping through the steps in the book and when I run the command wasm-pack build and the pkg directory gets created with all the appropriate files except the package.json, which is missing and I have to manually create it.

To Reproduce Specs:

  • MacOS v11.2 BigSur
  • Apple M1
  • rustc 1.50.0 (cb75ad5db 2021-02-10)
  • cargo 1.50.0 (f04e7fab7 2021-02-04)
  • nodejs v15.11.0
  • nvm v7.6.0 Steps to reproduce the behavior:
  1. Go to 'Build the project'
  2. Run command wasm-pack build
  3. In your editor, expand the pkg directory and you won't see a package.json file - see screenshot

Expected behavior Copied from book: pkg/ ├── package.json ├── README.md ├── wasm_game_of_life_bg.wasm ├── wasm_game_of_life.d.ts └── wasm_game_of_life.js

Screenshots Screen Shot 2021-03-16 at 3 43 18 PM

Additional context There may also be a bug related to a named project and importing the dependency for ../pkg and npm install, the package is still named wasm-game-of-life in the node_modules.

ev-rvs avatar Mar 16 '21 19:03 ev-rvs

Had the same issue, did you find a good workaround?

darknoon avatar Nov 13 '21 20:11 darknoon

I believe I generated one myself using npm init -y, but it's been a while ago. I then pieced together the packages and applied it to the package.json. I was hoping a bug would be created for this issue. Sorry you experienced this as well. Let me know if that works for you.

ev-rvs avatar Nov 15 '21 12:11 ev-rvs